You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm going to label this as confirm to see if anyone on the @nunit/framework-team can repro.
The check return Platform == PlatformID.Win32NT && Version.Major == 11 && Product == ProductType.WorkStation works as expected for me on Windows 11 Home 21H2.
The only place that information is used is in the IsPlatformSupported method:
and the code is just doing a check to be returned:
And the IsPlatformSupported method seems to only be used from tests. And the strings WIN11 and Windows11 also only appear in tests.
This test also probably has to go:
@nunit/framework-team : Why do we have this code at all? I've been trying to see where it actually test anything of the framework code . That doesn't mean it doesn't, only I haven't found it so far.
It seemed to internally detect it as Windows 11 for me on Windows 11 when stepping through the code, though I wasn't sure if it was because I'm on Home Edition. I think it could be helpful to confirm if this is a Pro edition issue or not.
Oh. I can't recall what runtime I tested on, but that could also be an issue here. Looks like the reliability of Environment.OSVersion improved on .NET5+
@stevenaw What do you mean by "repro" ? Do you get 10?
I have tested this on a WIn 10 machine and a WIn 11 Pro, and I do get the following:
Win 10:
Win 11 Pro:
So, if you get the same with WIn 11 Home, then we don't need the Win11 definitions. I see it is used in InsertEnvironmentElement, and then in the WriteXmlResultOutput, but it seems only informative. And is just plucked out the mscorelib. The IsSupported seems to only be used by tests. SO imho, I think we can delete some code here.
We have to change the IsWindows11 method to check for major version == 10 and minor=22000, that's it, as @pepone says. I don't think there is anything else to it. @stevenaw@jnm2
As even MS sees Windows11 as Windows10 do we need a Windows11 check?
Or do we need a minor check, eg. Windows10.19000 and Windows10.22000?
If we think a Windows11 check should stay, then we should fix the condition and update the nunit tests.
Should minor be >= 22000 so later updates of Win11 are found?
Yeah, that was my initial reaction too, just get rid of the code there, but @pepone also raised the original issue #4212 for this, and it seems someone is actually using that functionality. The method is public so it can be used externally, but should probably have been internal. Is has also been fixed in the documentation, so then I changed a bit to think it could stay. I actually don't see the purpose for these, some checks for parallelization is using some of this information, might be something more, but I am not quite sure. Agree that minor can be >= even if we're guessing a bit there on what happens in the future.
I don't think we need to fix any tests, but perhaps you see some I don't ? Found it ;-)
Lots happened here in the last 24 hrs 😅
Thanks for fixing this @OsirisTerje . I'd forgotten to explicitly call out the prop I was inspecting in the debugger, but you're right, the IsWindows11 check had been showing false for me. I'm unsure why it had been "working" earlier for me, but your PR seems to fix the underlying issue
Activity
jnm2 commentedon Oct 13, 2022
@SimonCropp
SimonCropp commentedon Oct 14, 2022
@pepone give you have the context here, can you submit a PR that fixes it
stevenaw commentedon Oct 30, 2022
I'm going to label this as
confirmto see if anyone on the @nunit/framework-team can repro.The check
return Platform == PlatformID.Win32NT && Version.Major == 11 && Product == ProductType.WorkStationworks as expected for me on Windows 11 Home 21H2.pepone commentedon Oct 31, 2022
On Windows 11 21H2 I see
Looking at NUnit code it just read CurrentMajorVersion,
nunit/src/NUnitFramework/framework/Internal/OSPlatform.cs
Lines 112 to 113 in 2c9490b
OsirisTerje commentedon Apr 30, 2023
@pepone seems to be correct, see https://learn.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version
@stevenaw I would assume the reason it works for you, is that it reports as Windows 10, and there are no real changes wrt NUnit.
@SimonCropp Can you correct this?
TL;DR;
The only place that information is used is in the IsPlatformSupported method:



and the code is just doing a check to be returned:
And the IsPlatformSupported method seems to only be used from tests. And the strings WIN11 and Windows11 also only appear in tests.
This test also probably has to go:

@nunit/framework-team : Why do we have this code at all? I've been trying to see where it actually test anything of the framework code . That doesn't mean it doesn't, only I haven't found it so far.
stevenaw commentedon Apr 30, 2023
It seemed to internally detect it as Windows 11 for me on Windows 11 when stepping through the code, though I wasn't sure if it was because I'm on Home Edition. I think it could be helpful to confirm if this is a Pro edition issue or not.
stevenaw commentedon Apr 30, 2023
Oh. I can't recall what runtime I tested on, but that could also be an issue here. Looks like the reliability of
Environment.OSVersionimproved on .NET5+https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/5.0/environment-osversion-returns-correct-version
I may have tested on NET6. I'm not at a computer to verify, but we should confirm on an older runtime like net462
stevenaw commentedon May 1, 2023
I'm confused now. I tried this again on the same machine as before while targeting .NET7 on main and I can now repro. I am still on Windows 11 Home.
OsirisTerje commentedon May 1, 2023
@stevenaw What do you mean by "repro" ? Do you get 10?
I have tested this on a WIn 10 machine and a WIn 11 Pro, and I do get the following:
Win 10:

Win 11 Pro:

So, if you get the same with WIn 11 Home, then we don't need the Win11 definitions. I see it is used in InsertEnvironmentElement, and then in the WriteXmlResultOutput, but it seems only informative. And is just plucked out the mscorelib. The IsSupported seems to only be used by tests. SO imho, I think we can delete some code here.
OsirisTerje commentedon May 1, 2023
We have to change the IsWindows11 method to check for major version == 10 and minor=22000, that's it, as @pepone says. I don't think there is anything else to it.
@stevenaw @jnm2
manfred-brands commentedon May 1, 2023
As even MS sees Windows11 as Windows10 do we need a Windows11 check?
Or do we need a minor check, eg. Windows10.19000 and Windows10.22000?
If we think a Windows11 check should stay, then we should fix the condition and update the nunit tests.
Should minor be >= 22000 so later updates of Win11 are found?
OsirisTerje commentedon May 1, 2023
Yeah, that was my initial reaction too, just get rid of the code there, but @pepone also raised the original issue #4212 for this, and it seems someone is actually using that functionality. The method is public so it can be used externally, but should probably have been internal. Is has also been fixed in the documentation, so then I changed a bit to think it could stay. I actually don't see the purpose for these, some checks for parallelization is using some of this information, might be something more, but I am not quite sure. Agree that minor can be >= even if we're guessing a bit there on what happens in the future.
I don't think we need to fix any tests, but perhaps you see some I don't ? Found it ;-)
Fixes #4237
Merge pull request #4374 from nunit/Issue4237
stevenaw commentedon May 1, 2023
Lots happened here in the last 24 hrs 😅
Thanks for fixing this @OsirisTerje . I'd forgotten to explicitly call out the prop I was inspecting in the debugger, but you're right, the
IsWindows11check had been showing false for me. I'm unsure why it had been "working" earlier for me, but your PR seems to fix the underlying issue