Debugging Blazor Server
If you have debugged any type of .NET application in the past, you will feel right at home. If you haven't, don't worry – we will go through it. Debugging Blazor Server is just as we might expect and is the best debugging experience of the three different types we will cover.
I usually keep my Razor pages in a shared library and while building my project, I use Blazor Server for two reasons – first, it's a bit faster to run the project, and second, the debugging experience is better.
Let's give it a try!
- Set BlazorServer as startup project.
- Press F5 to start the project (this time with debugging).
- Using the web browser, navigate to
https://localhost:portnumber/throwexception
(the port number may vary). - Press F12 to show the web browser developer tools.
- In the developer tools, click Console.
- Click the Throw exception button on our page.
At this point, Visual Studio should...