Environment.OSVersion is an unreliable API that reports old versions for compat purposes. It only reports the correct Win10 version if an app manifest is added. VS and the test runner have this manifest but sample apps and customer apps won't.
https://stackoverflow.com/questions/33328739/system-environment-osversion-returns-wrong-version
We're going to need a different way to check for this support. Worst case we look at the registry.
fwiw, dotnet-cli uses this property for dotnet --info, which I think does not rely on the app manifest: https://github.com/dotnet/runtime/blob/cf43585e854f78bdec51323875369778055fc249/src/installer/managed/Microsoft.DotNet.PlatformAbstractions/RuntimeEnvironment.cs#L16
Microsoft.DotNet.PlatformAbstractions package is obsolete.
P/Invoking Ntdll.RtlGetVersionEx is your best bet.
It only reports the correct Win10 version if an app manifest is added. VS and the test runner have this manifest but sample apps and customer apps won't.
This is considered to be a feature. It is not necessary something you want to "fix".
Microsoft.DotNet.PlatformAbstractions package is obsolete.
will its sources be removed and dotnet-cli switch to p/invoke?
Edit: nvm, found the issue tracking it - https://github.com/dotnet/runtime/issues/3470
This is considered to be a feature. It is not necessary something you want to "fix".
This version check is to see if the OS has the right TLS 1.3 support. Http3 will have other opt-in guards to maintain compat. Once a developer opts in, false negatives from this version check are an unnecessary hurdle and support burden.
@Tratcher - do you want me to update #36302 to add back the Environment.OSVersion check?
@jkotalik have you confirmed which version we need?
No, let's just merge what we have in that #36302 for now. I'll need to figure out if the Windows slow preview train has schannel support, which will take a while.
I'm thinking it's better to implement this in MsQuic -- https://github.com/microsoft/msquic/issues/92
Most helpful comment
Microsoft.DotNet.PlatformAbstractions package is obsolete.
P/Invoking
Ntdll.RtlGetVersionExis your best bet.