Skip to content
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

Mono-built SDK has error loading System.Reflection.MetadataLoadContext from MSBuild #3528

Closed
mthalman opened this issue Jun 19, 2023 · 8 comments · Fixed by dotnet/installer#16784
Assignees
Labels
area-upstream-fix Needs a change in a contributing repo

Comments

@mthalman
Copy link
Member

mthalman commented Jun 19, 2023

All, or most, of the tests are getting this error:

System.InvalidOperationException : Failed to execute /vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/.dotnet/dotnet build /bl:/vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/logs/BasicScenarioTests_Console_CSharp-build.binlog
Exit code: 1
MSBuild version 17.7.0-preview-23315-03+e33c36720 for .NET
MSBUILD : error MSB1021: Cannot create an instance of the logger. Microsoft.Build.BackEnd.Logging.CentralForwardingLogger Could not load type of field 'Microsoft.Build.Shared.TypeLoader:_context' (4) due to: Could not load file or assembly 'System.Reflection.MetadataLoadContext, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.

This is a regression and first showed up in this build (internal link).

This is blocking source-build and must be fixed for 8.0 Preview 6.

@omajid
Copy link
Member

omajid commented Jun 19, 2023

cc @Swapnali911

@mthalman
Copy link
Member Author

Moving to the runtime repo to investigate.

This regression occurred between the following commits in the VMR: https://github.com/dotnet/dotnet/compare/9dc0fc5..b294512

Notably, there are changes to mono included there from the changes in dotnet/runtime#87087. cc @kouvel

@mthalman mthalman changed the title Smoke tests failing in CentOSStream8_Mono_Offline_MsftSdk_x64 build leg Smoke tests failing in CentOSStream8_Mono_Offline_MsftSdk_x64 source-build leg Jun 19, 2023
@kouvel
Copy link
Member

kouvel commented Jun 19, 2023

The failure doesn't sound relevant to the changes in dotnet/runtime#87087. That PR only has minor changes to add 3 internal calls for events methods that are not actually called, and a minor change to the inclusion of a file, which I believe is correct, though perhaps if something is wrong it may cause build-time issues and I wouldn't expect any run-time issues.

@mthalman
Copy link
Member Author

@marek-safar - Can this get taken a look at soon? This needs to be fixed for Preview 6.

@ghost ghost removed the untriaged label Jun 21, 2023
@mthalman
Copy link
Member Author

Here's some context on what the tests are doing:

First, we use the source-build infrastructure to build .NET from source to produce an SDK. For the runtime repo, it uses the --usemonoruntime build option. Tests are run against that built SDK for a variety of scenarios. In this case, the tests that are failing are all attempting to do the same sort of thing. They create a new project using dotnet new (such as a console app template) and then simply attempt to build the project, specify a binlog output path. Here's an example:

/vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/.dotnet/dotnet build /bl:/vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/logs/BasicScenarioTests_Console_CSharp-build.binlog

This is the command which fails for these tests.

@janani66
Copy link

janani66 commented Jun 21, 2023

Wanted to add that we see a similar failure on ppc64le RHEL machine ( uses MONO runtime) with a dotnet built from preview5 using source-build i.e. a simple "Hello World" console app doesn't work.

$dotnet new console
The template "Console App" was created successfully.

Processing post-creation actions...
Restoring /root/test_hello/test_hello.csproj:
MSBUILD : error MSB1021: Cannot create an instance of the logger. Microsoft.Build.Logging.ConfigurableForwardingLogger Could not load type of field 'Microsoft.Build.Shared.TypeLoader:_context' (4) due to: Could not load file or assembly 'System.Reflection.MetadataLoadContext, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
Restore failed.
Post action failed.
Manual instructions: Run 'dotnet restore'

@mthalman mthalman changed the title Smoke tests failing in CentOSStream8_Mono_Offline_MsftSdk_x64 source-build leg Mono-built SDK has error loading System.Reflection.MetadataLoadContext from MSBuild Jun 21, 2023
@dotnet-issue-labeler
Copy link

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.

@mthalman mthalman transferred this issue from dotnet/runtime Jun 21, 2023
@mthalman
Copy link
Member Author

I've moved this back to source-build. This was caused by dotnet/installer#16637.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-upstream-fix Needs a change in a contributing repo
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants