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

[Unhandled Exception]: System.ObjectDisposedException: This object is no longer valid because the MetadataLoadContext that created it has been disposed. #11242

Open
pavelsavara opened this issue Jan 8, 2025 · 3 comments

Comments

@pavelsavara
Copy link
Member

pavelsavara commented Jan 8, 2025

Issue Description

Log

[] MSBUILD : error MSB4166: UNHANDLED EXCEPTIONS FROM PROCESS 1842:
[] MSBUILD : error MSB4166: =====================
[] MSBUILD : error MSB4166: 1/7/2025 5:29:23 PM
[] MSBUILD : error MSB4166: System.ObjectDisposedException: This object is no longer valid because the MetadataLoadContext that created it has been disposed.
[] MSBUILD : error MSB4166:    at System.Reflection.MetadataLoadContext.DisposeCheck()
[] MSBUILD : error MSB4166:    at System.Reflection.TypeLoading.Ecma.EcmaDefinitionType.ComputeDeclaringType()
[] MSBUILD : error MSB4166:    at System.Reflection.TypeLoading.RoType.get_DeclaringType()
[] MSBUILD : error MSB4166:    at System.Reflection.TypeLoading.RoDefinitionType.ComputeFullName()
[] MSBUILD : error MSB4166:    at System.Reflection.TypeLoading.RoType.get_FullName()
[] MSBUILD : error MSB4166:    at Microsoft.Build.Framework.LazyFormattedBuildEventArgs.WriteToStream(BinaryWriter writer)
[] MSBUILD : error MSB4166:    at Microsoft.Build.Framework.BuildMessageEventArgs.WriteToStream(BinaryWriter writer)
[] MSBUILD : error MSB4166:    at Microsoft.Build.Shared.LogMessagePacketBase.WriteToStream(ITranslator translator)
[] MSBUILD : error MSB4166:    at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.RunReadLoop(Stream localReadPipe, Stream localWritePipe, ConcurrentQueue`1 localPacketQueue, AutoResetEvent localPacketAvailable, AutoResetEvent localTerminatePacketPump)
[] MSBUILD : error MSB4166: ===================

Steps to Reproduce

I don't know how to reproduce.
It happened only once AFAIK during Wasm.Build.Tests.PInvokeTableGeneratorTests of dotnet/runtime build.

Since it happened on Helix machine I also don't have the detailed log.

mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-webassembly on a002M0D

.NET SDK Version: 10.0.100-alpha.1.24622.2

Actual Behavior

No exception

Analysis

No response

Versions & Configurations

No response

@pavelsavara
Copy link
Member Author

It's quite possible that there is parent msbuild process and multiple child msbuild processes running in parallel

@JanKrivanek
Copy link
Member

Thank you @pavelsavara for reporting!

On a first look it doesn't seem like msbuild would do anything wrong here - this seems to go from the type system.

@janvorli - would you be able to suggest who should have a look here?

@janvorli
Copy link
Member

janvorli commented Jan 9, 2025

@davidwrighton do you have any thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants