I've tried debugging in both vs code and vs.net 2019 and in both cases debugging everything bug Program.cs works. I'm trying to figure out why configuration isn't working but can't step into the code to see what's going on.
Anyone know how to debug this?
Blazor apps are composed of reusable web UI components implemented using C#, HTML, and CSS. Both client and server code is written in C#, allowing you to share code and libraries.
Ahead-of-time (AOT) compilation. Blazor WebAssembly supports ahead-of-time (AOT) compilation, where you can compile your . NET code directly into WebAssembly. AOT compilation results in runtime performance improvements at the expense of a larger app size.
I'm pretty sure that you can't debug the Program.cs
. I don't remember where I read it (it's here), but I think it said that it had something to do with the debugger attaching to the process after everything in the Program.cs
file has been executed. What I do is in any place that I want to check variables or values in that file, I write them to the console. The call to Console.WriteLine()
in the Program.cs
file just writes directly to the browser's developer console. It isn't the easiest way to debug, but it has worked for me several times.
I think the same goes for the first razor component page that is loaded, the debugger will not attach till after it's OnInitialized()
or OnInitializedAsync()
methods have executed, but any subsequent pages after that should stop on breakpoints. Or even if you navigate away from that first page then navigate back it should then hit your breakpoints.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With