You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When enabling fluent themes in WPF in .NET 9 and high contrast mode is on in Windows, or fluent themes are already enabled and then high contrast mode is enabled, the app will crash with a System.Windows.Markup.XamlParseException. The full exception is:
System.Windows.Markup.XamlParseException: 'Set property 'System.Windows.ResourceDictionary.DeferrableContent' threw an exception.'
ArgumentException: Item has already been added. Key in dictionary: 'SystemColorWindowColorBrush' Key being added: 'SystemColorWindowColorBrush'
Yes, not an issue with the old themes and older versions of .NET nor .NET Framework.
Known Workarounds
Enable the fluent themes using the Application.ThemeMode property within a try catch. App will still crash once the themes are enabled and the user turns on high contrast mode, but not if it was already on.
Impact
WPF cannot be used with the fluent themes while high contrast mode is enabled on the system.
Configuration
.NET 9, AnyCPU, Windows 11 build 22631.4037.
Other information
No response
The text was updated successfully, but these errors were encountered:
Description
When enabling fluent themes in WPF in .NET 9 and high contrast mode is on in Windows, or fluent themes are already enabled and then high contrast mode is enabled, the app will crash with a System.Windows.Markup.XamlParseException. The full exception is:
Reproduction Steps
Expected behavior
The app should not crash.
Actual behavior
The app crashes.
Regression?
Yes, not an issue with the old themes and older versions of .NET nor .NET Framework.
Known Workarounds
Enable the fluent themes using the Application.ThemeMode property within a try catch. App will still crash once the themes are enabled and the user turns on high contrast mode, but not if it was already on.
Impact
WPF cannot be used with the fluent themes while high contrast mode is enabled on the system.
Configuration
.NET 9, AnyCPU, Windows 11 build 22631.4037.
Other information
No response
The text was updated successfully, but these errors were encountered: