Roadmap › Exception Handling & Custom Error Handling in .NET — Every Way, Every App Type › Module: Error Handling by Application Type
Lessons in this course (9)
7. Blazor, MAUI/WPF/WinForms and console apps
IntermediateMediumLesson 7 of 9
- Blazor:
<ErrorBoundary>around components shows fallback UI when a child component throws; unhandled errors in Blazor Server break the circuit — show the#blazor-error-uiand log on the server.
razor
<ErrorBoundary>
<ChildContent><OrderGrid /></ChildContent>
<ErrorContent><p class="alert alert-danger">Couldn't load orders. Please retry.</p></ErrorContent>
</ErrorBoundary>- WinForms:
Application.ThreadException(UI thread) +Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException)+AppDomain.UnhandledException. - WPF:
Application.DispatcherUnhandledException(sete.Handled = trueafter logging if safe). - Console/worker: try/catch in
Mainaround the host run, log fatal, return a non-zero exit code.