Debugging Blazor Server
If you have debugged any .NET application in the past, you will feel right at home. Don’t worry; we will go through it if you haven’t. 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, running the project is a bit faster, and second, the debugging experience is better.
Let’s give it a try!
- 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 request focus, and it should show the exception as shown in Figure...