Open wfjsw opened 1 year ago
The exception does not occur if you pass false
to Theme.Apply
's updateAccent
. So a possible workaround would be to try passing true
and retry with passing false
on FileNotFoundException
, e.g.
private void ApplyTheme()
{
try
{
Theme.Apply(_settings.DarkMode ? ThemeType.Dark : ThemeType.Light, WindowBackdropType, _updateAccentColor);
}
catch (FileNotFoundException)
{
if (_updateAccentColor)
{
_updateAccentColor = false;
ApplyTheme();
}
}
}
Another way would be to determine the actual Windows version the error occurs on and implement a check for it's version number. This could probably be introduced into the actual code base also. I sadly can't do that as I got no systems to test on.
There may be a problem with windows. When calling DwmGetColorizationParameters, you will encounter a 0x80070002 exception. I tried changing the theme color in settings and the problem was solved
There may be a problem with windows. When calling DwmGetColorizationParameters, you will encounter a 0x80070002 exception. I tried changing the theme color in settings and the problem was solved
Changing the colour theme and default windows mode (light/dark) in windows settings solves the problem for me
I am randomly experiencing this issue while turning on/off high contrast or switching between high contrast modes Windows 10 22H2
Describe the bug
The DWM api is throwing a
System.IO.FileNotFoundException
when accessingDwmapi.DwmGetColorizationParameters(out DWMCOLORIZATIONPARAMS dwParameters)
To Reproduce
Unknown
Expected behavior
The error is caught and a default color is applied
Screenshots
No response
OS version
Windows 10.0.22621
.NET version
.NET 6.0.16
WPF-UI NuGet version
https://github.com/lepoco/wpfui/commit/91a708991a69f168943e8d961cc123bf8ca92965
Additional context