-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Environment.OSVersion returns "Windows NT 10.0.22458.0" on my Windows 11 22458.1000 #59427
Comments
.NET 4 just like .NET only returns what we get from the OS. There are likely other APIs you can directly call using p/invoke. But I'll throw this over to runtime for better guidance. The repos here only deal with .NET Core and .NET 5, not .NET Framework |
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Thanks for your reply. |
Tagging subscribers to this area: @dotnet/area-system-runtime Issue DetailsI am using .NET Framework 4.0.
|
@mingtong for what purpose do you need to read the OS version? In theory logging/diagnostics is one of the few valid purposes. Generally it's not recommended to use the OS version to decide whether a feature is supported, because it might get supported later. |
I pass the OS version to server, and server decide which data will be returned. My App wants to support Windows 11 in advance, so I want to have it testable as early as possible, then once 11 be released, we can announce we support the latest Windows. You said it's not recommended, then what is the best practice to do it? |
@mingtong I see. Could you share why the server needs to know the OS version of the client? What is the data and how does it change? If you lied and told the server you were running on a Windows 10 client, would it be a problem? |
Some data is not expected to be shown on target OS. |
@mingtong but why is the version relevant -- why does the code need to be refactored? for what purpose is the version used? If for example, you're checking whether a feature is supported, often there are more reliable ways to do this than checking a version number. Eg., GetProcAddress. |
This issue has been automatically marked Please refer to our contribution guidelines for tips on what information might be required. |
I am using .NET Framework 4.0.
Will the API return correct OS Version after Windows 11 released?
Sorry, I mean, what OS Version will be returned after Windows 11 released?
The text was updated successfully, but these errors were encountered: