fix-analyzers throwing error.
See original GitHub issueWhen running the latest development build. --version 5.0.136601
It runs through until it hits, Running Formatters then throws an error. Fix-style is working fine.
Running formatters. Unhandled exception: System.IO.FileLoadException: Assembly with same name is already loaded at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly) at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath) at System.Reflection.Assembly.LoadFrom(String assemblyFile) at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerReferenceInformationProvider.<>c.<GetAnalyzersAndFixers>b__0_1(String path) in /_/src/Analyzers/AnalyzerReferenceInformationProvider.cs:line 28
The full set of analyzers returned are:
[0]: ".nuget\\packages\\microsoft.entityframeworkcore.analyzers\\3.1.4\\analyzers\\dotnet\\cs\\Microsoft.EntityFrameworkCore.Analyzers.dll"
[1]: "packages\\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.VersionCheckAnalyzer.resources.dll"
[2]: "packages\\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.6\\analyzers\\dotnet\\Microsoft.CodeAnalysis.VersionCheckAnalyzer.dll"
[3]: "packages\\Microsoft.CodeQuality.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Humanizer.dll"
[4]: "packages\\Microsoft.CodeQuality.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.CodeQuality.Analyzers.dll"
[5]: "packages\\Microsoft.CodeQuality.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.CodeQuality.CSharp.Analyzers.dll"
[6]: "packages\\Microsoft.NetCore.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.NetCore.Analyzers.dll"
[7]: "packages\\Microsoft.NetCore.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.NetCore.CSharp.Analyzers.dll"
[8]: "packages\\Microsoft.NetFramework.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.NetFramework.Analyzers.dll"
[9]: "packages\\Microsoft.NetFramework.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.NetFramework.CSharp.Analyzers.dll"
[10]: "C:\\Program Files\\dotnet\\sdk\\3.1.301\\Sdks\\Microsoft.NET.Sdk.Web\\analyzers\\cs\\Microsoft.AspNetCore.Analyzers.dll"
[11]: "C:\\Program Files\\dotnet\\sdk\\3.1.301\\Sdks\\Microsoft.NET.Sdk.Web\\analyzers\\cs\\Microsoft.AspNetCore.Mvc.Analyzers.dll"
[12]: "C:\\Program Files\\dotnet\\sdk\\3.1.301\\Sdks\\Microsoft.NET.Sdk.Web\\analyzers\\cs\\Microsoft.AspNetCore.Components.Analyzers.dll"
[13]: ".nuget\\packages\\microsoft.codeanalysis.analyzers\\2.9.4\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.Analyzers.dll"
[14]: ".nuget\\packages\\microsoft.codeanalysis.analyzers\\2.9.4\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.CSharp.Analyzers.dll"
[15]: ".nuget\\packages\\microsoft.entityframeworkcore.analyzers\\3.1.4\\analyzers\\dotnet\\cs\\Microsoft.EntityFrameworkCore.Analyzers.dll"
[16]: ".nuget\\packages\\microsoft.codeanalysis.analyzers\\2.9.4\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.Analyzers.dll"
[17]: ".nuget\\packages\\microsoft.codeanalysis.analyzers\\2.9.4\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.CSharp.Analyzers.dll"
[18]: ".nuget\\packages\\microsoft.entityframeworkcore.analyzers\\3.1.4\\analyzers\\dotnet\\cs\\Microsoft.EntityFrameworkCore.Analyzers.dll"
[19]: ".nuget\\packages\\xunit.analyzers\\0.10.0\\analyzers\\dotnet\\cs\\xunit.analyzers.dll"
[20]: ".nuget\\packages\\microsoft.entityframeworkcore.analyzers\\3.1.4\\analyzers\\dotnet\\cs\\Microsoft.EntityFrameworkCore.Analyzers.dll"
[21]: ".nuget\\packages\\microsoft.entityframeworkcore.analyzers\\3.1.4\\analyzers\\dotnet\\cs\\Microsoft.EntityFrameworkCore.Analyzers.dll"
[22]: ".nuget\\packages\\xunit.analyzers\\0.10.0\\analyzers\\dotnet\\cs\\xunit.analyzers.dll"
[23]: "C:\\Program Files\\dotnet\\sdk\\3.1.301\\Sdks\\Microsoft.NET.Sdk.Web\\analyzers\\cs\\Microsoft.AspNetCore.Analyzers.dll"
[24]: "C:\\Program Files\\dotnet\\sdk\\3.1.301\\Sdks\\Microsoft.NET.Sdk.Web\\analyzers\\cs\\Microsoft.AspNetCore.Mvc.Analyzers.dll"
[25]: "C:\\Program Files\\dotnet\\sdk\\3.1.301\\Sdks\\Microsoft.NET.Sdk.Web\\analyzers\\cs\\Microsoft.AspNetCore.Components.Analyzers.dll"
[26]: ".nuget\\packages\\microsoft.aspnetcore.components.analyzers\\3.1.3\\analyzers\\dotnet\\cs\\Microsoft.AspNetCore.Components.Analyzers.dll"
[27]: ".nuget\\packages\\microsoft.codeanalysis.analyzers\\2.9.4\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.Analyzers.dll"
[28]: ".nuget\\packages\\microsoft.codeanalysis.analyzers\\2.9.4\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.CSharp.Analyzers.dll"
[29]: ".nuget\\packages\\microsoft.entityframeworkcore.analyzers\\3.1.4\\analyzers\\dotnet\\cs\\Microsoft.EntityFrameworkCore.Analyzers.dll"
[30]: ".nuget\\packages\\xunit.analyzers\\0.10.0\\analyzers\\dotnet\\cs\\xunit.analyzers.dll"
[31]: ".nuget\\packages\\xunit.analyzers\\0.10.0\\analyzers\\dotnet\\cs\\xunit.analyzers.dll"
[32]: ".nuget\\packages\\microsoft.aspnetcore.components.analyzers\\3.1.3\\analyzers\\dotnet\\cs\\Microsoft.AspNetCore.Components.Analyzers.dll"
[33]: ".nuget\\packages\\microsoft.codeanalysis.analyzers\\2.9.4\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.Analyzers.dll"
[34]: ".nuget\\packages\\microsoft.codeanalysis.analyzers\\2.9.4\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.CSharp.Analyzers.dll"
[35]: ".nuget\\packages\\microsoft.entityframeworkcore.analyzers\\3.1.4\\analyzers\\dotnet\\cs\\Microsoft.EntityFrameworkCore.Analyzers.dll"
[36]: ".nuget\\packages\\xunit.analyzers\\0.10.0\\analyzers\\dotnet\\cs\\xunit.analyzers.dll"
[37]: ".nuget\\packages\\microsoft.entityframeworkcore.analyzers\\3.1.4\\analyzers\\dotnet\\cs\\Microsoft.EntityFrameworkCore.Analyzers.dll"
[38]: ".nuget\\packages\\xunit.analyzers\\0.10.0\\analyzers\\dotnet\\cs\\xunit.analyzers.dll"
[39]: ".nuget\\packages\\microsoft.entityframeworkcore.analyzers\\3.1.5\\analyzers\\dotnet\\cs\\Microsoft.EntityFrameworkCore.Analyzers.dll"
[40]: ".nuget\\packages\\xunit.analyzers\\0.10.0\\analyzers\\dotnet\\cs\\xunit.analyzers.dll"
[41]: ".nuget\\packages\\microsoft.aspnetcore.components.analyzers\\3.1.3\\analyzers\\dotnet\\cs\\Microsoft.AspNetCore.Components.Analyzers.dll"
And the distinct list:
[0]: ".nuget\\packages\\microsoft.entityframeworkcore.analyzers\\3.1.4\\analyzers\\dotnet\\cs\\Microsoft.EntityFrameworkCore.Analyzers.dll"
[1]: packages\\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.VersionCheckAnalyzer.resources.dll"
[2]: packages\\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.6\\analyzers\\dotnet\\Microsoft.CodeAnalysis.VersionCheckAnalyzer.dll"
[3]: packages\\Microsoft.CodeQuality.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Humanizer.dll"
[4]: packages\\Microsoft.CodeQuality.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.CodeQuality.Analyzers.dll"
[5]: packages\\Microsoft.CodeQuality.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.CodeQuality.CSharp.Analyzers.dll"
[6]: packages\\Microsoft.NetCore.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.NetCore.Analyzers.dll"
[7]: packages\\Microsoft.NetCore.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.NetCore.CSharp.Analyzers.dll"
[8]: packages\\Microsoft.NetFramework.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.NetFramework.Analyzers.dll"
[9]: packages\\Microsoft.NetFramework.Analyzers.2.9.6\\analyzers\\dotnet\\cs\\Microsoft.NetFramework.CSharp.Analyzers.dll"
[10]: "C:\\Program Files\\dotnet\\sdk\\3.1.301\\Sdks\\Microsoft.NET.Sdk.Web\\analyzers\\cs\\Microsoft.AspNetCore.Analyzers.dll"
[11]: "C:\\Program Files\\dotnet\\sdk\\3.1.301\\Sdks\\Microsoft.NET.Sdk.Web\\analyzers\\cs\\Microsoft.AspNetCore.Mvc.Analyzers.dll"
[12]: "C:\\Program Files\\dotnet\\sdk\\3.1.301\\Sdks\\Microsoft.NET.Sdk.Web\\analyzers\\cs\\Microsoft.AspNetCore.Components.Analyzers.dll"
[13]: ".nuget\\packages\\microsoft.codeanalysis.analyzers\\2.9.4\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.Analyzers.dll"
[14]: ".nuget\\packages\\microsoft.codeanalysis.analyzers\\2.9.4\\analyzers\\dotnet\\cs\\Microsoft.CodeAnalysis.CSharp.Analyzers.dll"
[15]: ".nuget\\packages\\xunit.analyzers\\0.10.0\\analyzers\\dotnet\\cs\\xunit.analyzers.dll"
[16]: ".nuget\\packages\\microsoft.aspnetcore.components.analyzers\\3.1.3\\analyzers\\dotnet\\cs\\Microsoft.AspNetCore.Components.Analyzers.dll"
[17]: ".nuget\\packages\\microsoft.entityframeworkcore.analyzers\\3.1.5\\analyzers\\dotnet\\cs\\Microsoft.EntityFrameworkCore.Analyzers.dll"
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (12 by maintainers)
Top GitHub Comments
One per project is likely the correct design moving forward
Since we can’t load analyzers side-by-side on .NET Core (and we know dotnet-format is running on .NET Core, we should be using an assembly load context for the analyzers which allows them to be loaded even when there is more than one analyzer with the same name in the solution.