roslyn
roslyn copied to clipboard
ProjectSystemProject.UpdateProjectAnalyzerReferences is causing I/O under a lock
ProjectSystemProject.UpdateProjectAnalyzerReferences has this line:
https://github.com/dotnet/roslyn/blob/a89e286de3a509dd1d96db7d7e131a0c10a77917/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.cs#L830
The constructor for AnalyzerFileReference calls IAnalyzerAssemblyLoader.AddDependencyLocation, which does a bunch of I/O to read the assembly from disk to check its assembly name. This is happening under the main workspace lock which can slow things down during solution load. I see a few possible fixes:
- Have the work in AnalyzerAssemblyLoader.AddDependencyLocation be lazy until the first time a load actually happens.
- Just use a no-op implementation of IAnalyzerAssemblyLoader, since at this point we don't expect to be loading analyzers at all in-process.