FindMyFiles

FindMyFiles.Services

ExceptionPolicy Class

The single home for the process-wide exception funnels (don't crash / don't hang / don't go silent). Three sources, three suppression rules:

1. XAML Microsoft.UI.Xaml.Application.UnhandledException — suppressed (Handled = true) and surfaced as an error InfoBar for the first FindMyFiles.Services.ExceptionPolicy.XamlStormBudget occurrences. Beyond that the process is in an exception storm: a crash marker is written and the exception is left unhandled so the process dies honestly. 2. System.AppDomain.UnhandledException — never suppressible by contract: log + crash marker, then the runtime terminates. 3. System.Threading.Tasks.TaskScheduler.UnobservedTaskException — always observed (the task is already dead; tearing the process down helps nobody) and surfaced as an error InfoBar.

Log routing: every path writes to FileLog (%APPDATA%\find-my-files\logs\app.log); user-visible surfaces go through Notifier, which mirrors to the same log. Crash markers are written by the fatal paths (1-storm and 2) and read back + cleared by ReportPreviousCrash() on the next launch, so no crash is ever silent.

public sealed class ExceptionPolicy

Inheritance System.Object → ExceptionPolicy

Methods

ExceptionPolicy.Install(Application) Method

Wire all three funnels. Call once, from the App constructor.

public static void Install(Microsoft.UI.Xaml.Application app);

Parameters

app Microsoft.UI.Xaml.Application

The WinUI application whose exception events are hooked.

ExceptionPolicy.ReportPreviousCrash() Method

Surface the previous run's crash marker (if any) as a warning InfoBar; reading clears the marker.

public static void ReportPreviousCrash();