Skip to content

Microsoft.NET.StringTools not properly loading into separate ALC #9572

@JanKrivanek

Description

@JanKrivanek

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:

image

Possible investigation steps

  1. Load Microsoft.Build.dll into custom Assembly Load Context
  2. 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);
  1. Inspect the ACL being used for all involved MSBuild assemblies. If you decide to use ETW for investigation, you can:

    1. 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
    
    1. And then filter-in the Microsoft-Windows-DotNETRuntime/AssemblyLoader EventTypes and Microsoft.NET.StringTools (and possbily Microsoft.Build as well) data. For easier viewing you can setup AssemblyName ActivityID Success * columns.

    image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions