From 26e01a7fc8ec965c365b275a77adb4e7522317f1 Mon Sep 17 00:00:00 2001 From: Kristen Schau <47155823+krschau@users.noreply.github.com> Date: Wed, 19 Jun 2024 20:11:14 +0100 Subject: [PATCH] Enable FailFastOnErrors for debug builds (#3244) --- src/App.xaml.cs | 3 +++ src/DevHome.csproj | 4 ++++ src/MainWindow.xaml.cs | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/src/App.xaml.cs b/src/App.xaml.cs index f9f9c6c5d3..234b4bfe04 100644 --- a/src/App.xaml.cs +++ b/src/App.xaml.cs @@ -79,6 +79,9 @@ private static string RemoveComments(string text) public App() { InitializeComponent(); +#if DEBUG + DebugSettings.FailFastOnErrors = true; +#endif _dispatcherQueue = DispatcherQueue.GetForCurrentThread(); Host = Microsoft.Extensions.Hosting.Host. diff --git a/src/DevHome.csproj b/src/DevHome.csproj index 7eec2e6d43..6d7cdcdd09 100644 --- a/src/DevHome.csproj +++ b/src/DevHome.csproj @@ -156,6 +156,10 @@ $(DefineConstants);STABLE_BUILD + + $(DefineConstants);DEBUG + + diff --git a/src/MainWindow.xaml.cs b/src/MainWindow.xaml.cs index 54b777f881..e9c2db07dc 100644 --- a/src/MainWindow.xaml.cs +++ b/src/MainWindow.xaml.cs @@ -29,5 +29,9 @@ private void MainWindow_Closed(object sender, WindowEventArgs args) Application.Current.GetService().SignalStopExtensionsAsync(); TelemetryFactory.Get().Log("DevHome_MainWindow_Closed_Event", LogLevel.Critical, new DevHomeClosedEvent(_mainWindowCreated)); Log.Information("Terminating via MainWindow_Closed."); + + // WinUI bug is causing a crash on shutdown when FailFastOnErrors is set to true (#51773592). + // Workaround by turning it off before shutdown. + App.Current.DebugSettings.FailFastOnErrors = false; } }