- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.4k
Closed
Description
Context
This is based on the #9538
Microsoft.NET.StringTools is not being loaded into separate AssemblyLoadContext properly in the C# DevKit leading to regression issues in case of changes in functionality of StringTools.
Details
The Microsoft.NET.StringTools.dll is located in the sdk folder along with the othe MSBuild assemblies that are trying to load it, however it fails to be loaded into nondefault ACL, fallbacking to the default ACL which already has StringTools loaded into separate ACL:
Possible investigation steps
- Load Microsoft.Build.dll into custom Assembly Load Context
- Execute code that will lead to pulling other binaries - e.g. simple evaluation of a Project should do:
var path = "some\csrpoj\path.csproj";
var toolsVersion = "Current";
var xml = Microsoft.Build.Construction.ProjectRootElement.Open(path);
var rootProj = new Microsoft.Build.Evaluation.Project(xml, Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.GlobalProperties, toolsVersion);- 
Inspect the ACL being used for all involved MSBuild assemblies. If you decide to use ETW for investigation, you can: - Collect the counters via (need to be started before the scenario execution and ctrl-c after scenario done):
 .\PerfView.exe collect /NoGui /Providers=Microsoft-Windows-DotNETRuntime /NoNGenRundown /Merge:False /DataFile:msbuild-alc-etw /BufferSize:8096 /CircularMB:8096- And then filter-in the Microsoft-Windows-DotNETRuntime/AssemblyLoaderEventTypes andMicrosoft.NET.StringTools(and possbilyMicrosoft.Buildas well) data. For easier viewing you can setupAssemblyName ActivityID Success *columns.
 

