-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Application does not respect the system color settings due to bad detection by SystemColorsSupported #143
Comments
I don't think that's a workaround, I think that's the right way to do it. |
If the info about the need of |
Wouldn't it be better to detect if the system colors are supported in another way if possible (rather than detecting it by OS version)? I don't think this is a good practice and Microsoft developers do not think it either: |
Hey @SuperMartas, That's because this library uses WinRT (UWP) APIs to fetch system themes and colours on Windows 10 and will fallback on older windows versions. Thus the version check is added to prevent exceptions, it could be reason to add the manifest. You're right. Instead of checking the version, the API availability could be checked. |
It actually used to, on .NET 5 preview 5. I'm unsure what has changed, but adding the manifest file and changes fixed it for me as well. |
@hizamakura, What? |
Sorry, I mean it fetched the system's default color properly on .NET 5 Preview 5. After updating the preview version to Preview 6, the app wouldn't run at all, and I had to switch to .NET Core 3.1 and I observed the same issues. I get |
Yes, they removed inbuilt WinRT support starting from preview 6. It won't work the same way now like it used to in .NET Core 3.x or .NET 5 preview 5. It's a different issue (see #140). But this issue can happen on .NET Framework, .NET Core 3.x and .NET 5. Adding app.manifest and un-commenting the supported OSes will solve this issue. While the .NET 5 issue is a separate one (see #140) |
I'm not aware of a reliable way to check the availability of WinRT, but implementing OS version check without requiring app.manifest should be doable. |
The requirement of app.manifest has been removed by 2c27fba. |
If I try to use the library in my .NET Core 3.1 project, the system color settings is not respected when running from Visual Studio or directly from exe. This is not a problem in JetBrains Rider IDE. The issue is that Environment.OSVersion.Version (used in ColorsHelper.SystemColorsSupported) shows version 6.2.9200 but the library tests Major version for >=10, which can't happen. This could happen because of this: https://docs.microsoft.com/en-US/windows/win32/sysinfo/targeting-your-application-at-windows-8-1 (https://www.prugg.at/2019/09/09/properly-detect-windows-version-in-c-net-even-windows-10/).
I found out a temporary workaround by adding app.manifest to the project (right click on project in solution explorer -> Add -> New item... -> Application Manifest File (Windows only)) and then uncommenting line
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
.The text was updated successfully, but these errors were encountered: