dotnet / dotnet/msbuild

Remove assumption that MSBuild controls AssemblyLoadContext.Default

Open
#6,794 5 comments 2 reactions 0 assignees View on GitHub
.NET Core Area: Engine triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

MSBuild has several explicit references to `AssemblyLoadContext.Default`. That prevents an application from using the MSBuild API in a disposable (or otherwise managed) context.

https://github.com/dotnet/msbuild/blob/414393fc1ff0e808865a088c826122694fc4fe3f/src/Shared/TaskEngineAssemblyResolver.cs#L126

https://github.com/dotnet/msbuild/blob/414393fc1ff0e808865a088c826122694fc4fe3f/src/Shared/MSBuildLoadContext.cs#L82-L85

This one is potentially OK since it's only to support an escape-hatch feature, but we can also consider removing it:

https://github.com/dotnet/msbuild/blob/414393fc1ff0e808865a088c826122694fc4fe3f/src/Shared/CoreCLRAssemblyLoader.cs#L65-L83

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.