Making things break
Edsger W. Dijkstra once said,
"If debugging is the process of removing software bugs, then programming must be the process of putting them in."
This is definitely true in this section because we will add a page that will throw an exception:
- In the Components project, in the Pages folder, create a new class called ThrowException.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.