-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Upgrading to .NET6 breaks unit tests which launch 32-bit .NET processes #22647
Comments
The issue is only reproducible when the 32-bit process being launched is .NET6 (compiling it for .NET5 resolves the issue). |
We did some change on framework resolver algorithm in 6.0 that breaks this specific scenario; start x86 process from x64 test host process. You can try 2 workaround to solve the issue.
process.StartInfo.EnvironmentVariables.Remove("DOTNET_ROOT");
<PropertyGroup>
<TargetFramework>6.0</TargetFramework>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup> & "C:\Program Files (x86)\dotnet\dotnet" test |
The first workaround works well, feel free to close. Is this also the recommended way of running a 32-bit .NET EXE if the host has set DOTNET_ROOT in general? |
Generally speaking, you should not set DOTNET_ROOT* environment variables, test host process is a special case. |
Tests which launch 32-bit .NET processes fail after upgrading to .NET6 when run from the CLI (running via VS works fine). The 32-bit exe fails to launch with:
The issue does not occur when using .NET5 or when running the test via the VS test explorer.
The issue has been reported on the NUnit3TestAdapter repo since, but apparently the adapter is in play even when running via the VS test explorer (suggesting that the issue may lie elsewhere). Issue: nunit/nunit3-vs-adapter#917
Here's a repo with a minimal reproducible example and a COREHOST trace file: https://github.com/handerss-tibco/net6-nunit-32bit-fail
Here's the trace file: https://github.com/handerss-tibco/net6-nunit-32bit-fail/blob/main/trace.txt
The trace file indicates that the runtime identifier is being set to 64-bit before launch of the 32-bit exe:
Versions:
.NET SDK: 6.0.100
Microsoft.NET.Test.Sdk 17.0.0
NUnit 3.13.2
NUnit3TestAdapter: 4.1.0
The text was updated successfully, but these errors were encountered: