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.