mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Revert "Fix: Silently handle InvalidCastException from WPF system resource invalidation on Windows theme change"
This reverts commit 372f142b49.
This commit is contained in:
parent
372f142b49
commit
41d5e0a27a
2 changed files with 0 additions and 25 deletions
|
|
@ -25,12 +25,6 @@ public static class ErrorReporting
|
||||||
// This change modifies the behavior to log the exception instead of showing the "Error report UI".
|
// This change modifies the behavior to log the exception instead of showing the "Error report UI".
|
||||||
if (ExceptionHelper.IsRecoverableDwmCompositionException(e)) return;
|
if (ExceptionHelper.IsRecoverableDwmCompositionException(e)) return;
|
||||||
|
|
||||||
// Workaround for a WPF issue where changing the Windows theme or accent color triggers
|
|
||||||
// SystemResources.InvalidateTreeResources, which tries to clone Color values stored in styles
|
|
||||||
// and fails with an InvalidCastException. This is a benign framework-level exception that
|
|
||||||
// does not affect Flow Launcher functionality, so we log it silently instead of showing the error dialog.
|
|
||||||
if (ExceptionHelper.IsRecoverableSystemResourceException(e)) return;
|
|
||||||
|
|
||||||
var reportWindow = new ReportWindow(e);
|
var reportWindow = new ReportWindow(e);
|
||||||
reportWindow.Show();
|
reportWindow.Show();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,23 +39,4 @@ internal static class ExceptionHelper
|
||||||
return !string.IsNullOrEmpty(stackTrace) &&
|
return !string.IsNullOrEmpty(stackTrace) &&
|
||||||
stackTrace.Contains("DwmCompositionChanged", StringComparison.OrdinalIgnoreCase);
|
stackTrace.Contains("DwmCompositionChanged", StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if the exception is a recoverable WPF system resource invalidation exception
|
|
||||||
/// that occurs when Windows changes its theme or accent colors. This is a known WPF issue where
|
|
||||||
/// <c>Color</c> values stored in styles are incorrectly cloned during resource tree invalidation.
|
|
||||||
/// </summary>
|
|
||||||
internal static bool IsRecoverableSystemResourceException(Exception exception)
|
|
||||||
{
|
|
||||||
if (exception is not InvalidCastException)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for the specific Color-to-Expression cast failure originating from WPF's
|
|
||||||
// SystemResources.InvalidateTreeResources, triggered by Windows theme/accent color changes.
|
|
||||||
var stackTrace = exception.StackTrace;
|
|
||||||
return !string.IsNullOrEmpty(stackTrace) &&
|
|
||||||
stackTrace.Contains("System.Windows.SystemResources.InvalidateTreeResources", StringComparison.Ordinal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue