Repository navigation
Description
Description
Using a Mono runtime based "dotnet" host to build and run the runtime libs.tests target currently fails with an error running the Microsoft.NETCore.Platforms.Tests test cases.
The actual command that fails is the following:
uweigand@m8345019:~/runtime/artifacts/bin/Microsoft.NETCore.Platforms.Tests/net6.0-Debug$ /home/uweigand/runtime/artifacts/bin/testhost/net6.0-Linux-Debug-s390x/dotnet exec --runtimeconfig Microsoft.NETCore.Platforms.Tests.runtimeconfig.json --depsfile Microsoft.NETCore.Platforms.Tests.deps.json xunit.console.dll Microsoft.NETCore.Platforms.Tests.dll -xml testResults.xml -nologo -notrait category=OuterLoop -notrait category=failing -method Microsoft.NETCore.Platforms.BuildTasks.Tests.GenerateRuntimeGraphTests.CanCreateRuntimeGraph
Discovering: Microsoft.NETCore.Platforms.Tests (method display = ClassAndMethod, method display options = None)
Discovered: Microsoft.NETCore.Platforms.Tests (found 1 of 18 test case)
Starting: Microsoft.NETCore.Platforms.Tests (parallel test collections = on, max threads = 8)
Microsoft.NETCore.Platforms.BuildTasks.Tests.GenerateRuntimeGraphTests.CanCreateRuntimeGraph [FAIL]
System.TypeInitializationException : The type initializer for 'Microsoft.NETCore.Platforms.BuildTasks.Tests.GenerateRuntimeGraphTests' threw an exception.
---- Microsoft.Build.Exceptions.InvalidProjectFileException : The result "" of evaluating the value "$(_generateRuntimeGraphTask)" of the "AssemblyFile" attribute in element <UsingTask> is not valid. /home/uweigand/runtime/artifacts/bin/Microsoft.NETCore.Platforms.Tests/net6.0-Debug/runtimeGroups.props
As it turns out, this is a known bug in MSBuild expression evaluation on big-endian systems, which was fixed here: dotnet/msbuild#6204 , but the test case currently pulls in MSBuild 16.9.0, which does not yet have this fix.
Configuration
I'm building natively on s390x-ibm-linux, using a .NET 6 Preview5 host toolchain rebuilt for s390x from the official sources (plus some extra patches required to support s390x - these are mostly backports from mainline plus pending PRs).
Regression?
It is a regression in the sense that the libs.tests target used to run successfully previously. But that is caused simply by the fact that the test cases exposing the problem were only added a few months back.
Other information
I have tried to fix the issue by updating the MSBuild requirement from 16.9.0 to 16.10.0 in eng/Versions.props:
Index: runtime/eng/Versions.props
===================================================================
--- runtime.orig/eng/Versions.props
+++ runtime/eng/Versions.props
@@ -140,7 +140,7 @@
These are used as reference assemblies only, so they must not take a ProdCon/source-build
version. Insert "RefOnly" to avoid assignment via PVP.
-->
- <RefOnlyMicrosoftBuildVersion>16.9.0</RefOnlyMicrosoftBuildVersion>
+ <RefOnlyMicrosoftBuildVersion>16.10.0</RefOnlyMicrosoftBuildVersion>
<RefOnlyMicrosoftBuildFrameworkVersion>$(RefOnlyMicrosoftBuildVersion)</RefOnlyMicrosoftBuildFrameworkVersion>
<RefOnlyMicrosoftBuildTasksCoreVersion>$(RefOnlyMicrosoftBuildVersion)</RefOnlyMicrosoftBuildTasksCoreVersion>
<RefOnlyMicrosoftBuildUtilitiesCoreVersion>$(RefOnlyMicrosoftBuildVersion)</RefOnlyMicrosoftBuildUtilitiesCoreVersion>
But that simply triggers a different error now:
/home/uweigand/runtime/src/libraries/Microsoft.NETCore.Platforms/tests/Microsoft.NETCore.Platforms.Tests.csproj : error NU1201: Project System.Security.AccessControl is not compatible with net472 (.NETFramework,Version=v4.7.2). Project System.Security.AccessControl supports: net6.0 (.NETCoreApp,Version=v6.0)
This in turn seems to be caused simply by the fact that Microsoft.Build 16.10.0 now has an indirect dependency on System.Security.AccessControl which wasn't present in 16.9.0, and System.Security.AccessControl is indeed not available on net472.
If I in addition remove net472 from the TargetFrameworks list for Microsoft.NETCore.Platforms/tests/Microsoft.NETCore.Platforms.Tests.csproj, then the test builds and runs fine on net6.0 with MSBuild 16.10.0.
Any suggestions on how to proceed here would be appreciated!
Activity
ericstj commentedon Jul 26, 2021
Good find. Normally the version of MSBuild used by a task doesn't matter since it is not bundled with the task, but here it does since we are hosting MSBuild in the test process rather than running on the one provided by the CLI.
It is available, but only in a PackageReference. The desktop configurations were recently removed, along with the package. Those may come back with a fix for #54341 cc @ViktorHofer.
In the meantime I think we can add a PackageReference to unblock this as the 5.0 package does support
net472and we should be able to force NuGet to use the package over the project there.uweigand commentedon Jul 26, 2021
Yes, that's exactly what I did in the PR linked above (#56025), which does fix the problem for me.
Upgrade to msbuild version 16.10 (#56025)