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-ui and 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 (set e.Handled = true after logging if safe).
  • Console/worker: try/catch in Main around the host run, log fatal, return a non-zero exit code.