Skip to content
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

[DarkMode] 'Application' does not contain a definition for 'SetColorMode' after .NET 10.0 is installed #12292

Closed
chaowendy opened this issue Oct 9, 2024 · 3 comments
Assignees
Labels
area-DarkMode Issues relating to Dark Mode feature

Comments

@chaowendy
Copy link

.NET version

9.0.100-rc.2.24474.11

Did it work in .NET Framework?

No

Did it work in any of the earlier releases of .NET Core or .NET 5+?

This is a new feature Dark Mode: #11857

Issue description

When enable DarkMode by Application.SetColorMode(SystemColorMode.Dark) in Program.cs file with .NET 10.0 installed, there are 2 errors as follows:
image

More Info: After uninstalling .NET 10.0, the 2 errors disappeared
image

Steps to reproduce

  1. Install .NET 10.0 SDK ;
  2. Create a .NET Winforms project ;
  3. Enable DarkMode by Application.SetColorMode(SystemColorMode.Dark) in Program.cs file and observe.
@chaowendy chaowendy added untriaged The team needs to look at this issue in the next triage area-DarkMode Issues relating to Dark Mode feature labels Oct 9, 2024
@KlausLoeffelmann
Copy link
Member

.NET 10 SDK is in alpha, and I am not sure at this point, that everything is integrating already as it is supposed to be.

But I agree, it sounds peculiar that the 10 SDK would then overwrite, what, the WinForms reference assemblies? And also, with what version? 8? Weird.

Let me take a look.

@KlausLoeffelmann
Copy link
Member

As I said. Currently, the .NET 10 alpha pulls in:

C:\.tools\.nuget\packages\microsoft.windowsdesktop.app.ref\9.0.0-preview.7.24405.2\ref\net9.0\System.Windows.Forms.dll

Which is not the correct version. I expect this to change with upcoming versions.
Closing this, as it will get fixed once the integration is up to date.

@JeremyKuhne, @Shyam-Gupta.

@dotnet-policy-service dotnet-policy-service bot removed the untriaged The team needs to look at this issue in the next triage label Oct 11, 2024
@chaowendy
Copy link
Author

Hi @KlausLoeffelmann , there are 3 scenarios:

  1. DarkMode is supported when I install SDK 10.0 and create a 10.0 project.
  2. DarkMode is not supported when I install SDK 10.0 and create a 9.0 project.
  3. DarkMode is supported when I uninstall SDK 10.0 and create a 9.0 project.

So from the last 2 scenarios, with the SDK 10.0 installed, Dark theme for 9.0 project is not supported. Is that expected? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-DarkMode Issues relating to Dark Mode feature
Projects
None yet
Development

No branches or pull requests

2 participants