Making things break
Edsger W. Dijkstra once said,
This is definitely true in this section because we will add a page that will throw an exception:
- In the
MyBlog.Shared
project, select thePages
folder, and press Shift + F2. Name the new fileThrowException.razor
. - Replace the contents of the file with the following code block:
@page "/ThrowException" <button @onclick="@(()=> {throw new Exception("Something is broken"); })">Throw an exception</button>
This page simply shows a button and when you press the button, it will throw an exception.
Great! We have our application's Ivan Drago (he wants to break you, but we might just beat him with some fancy debugging).
The next step is to take a look at Blazor Server debugging.