From 1f53b7cc4f33cca561da7e821a1580e4dd65a996 Mon Sep 17 00:00:00 2001 From: Kristen Schau <47155823+krschau@users.noreply.github.com> Date: Thu, 30 May 2024 15:14:31 -0400 Subject: [PATCH 1/3] Failfast on debug builds --- src/App.xaml.cs | 4 ++++ src/DevHome.csproj | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/App.xaml.cs b/src/App.xaml.cs index f9f9c6c5d3..1910eff9ec 100644 --- a/src/App.xaml.cs +++ b/src/App.xaml.cs @@ -170,6 +170,10 @@ public App() UnhandledException += App_UnhandledException; AppInstance.GetCurrent().Activated += OnActivated; + +#if DEBUG + DebugSettings.FailFastOnErrors = true; +#endif } public void ShowMainWindow() 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 + + From b46173f4a8801d164474dbef41ae339d7b7a13fa Mon Sep 17 00:00:00 2001 From: Kristen Schau <47155823+krschau@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:52:53 -0400 Subject: [PATCH 2/3] Turn off FailFastOnErrors before shutdown --- src/MainWindow.xaml.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/MainWindow.xaml.cs b/src/MainWindow.xaml.cs index 99f87a6802..1ba5dc0974 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; } } From 46672bab5df90eed7cd730634108aec9d25849b2 Mon Sep 17 00:00:00 2001 From: Kristen Schau <47155823+krschau@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:00:18 -0400 Subject: [PATCH 3/3] Move up turning on failfast --- src/App.xaml.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/App.xaml.cs b/src/App.xaml.cs index 1910eff9ec..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. @@ -170,10 +173,6 @@ public App() UnhandledException += App_UnhandledException; AppInstance.GetCurrent().Activated += OnActivated; - -#if DEBUG - DebugSettings.FailFastOnErrors = true; -#endif } public void ShowMainWindow()