Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
See original GitHub issueVersion Used: 6.0.2
Steps to Reproduce: Clone https://github.com/OoLunar/Tomoe/commit/f37434a797fa3c8906302989539b9400b1a3b851 on branch rewrite/DSP_3.0 (Apologies for the non-minimal repro, unsure on how to reproduce)
Expected Behavior:
Successfully formatted <x>
files.
Actual Behavior:
[lunar@J-Laptop 03:03:54pm ~/Code/Lunar/Tomoe]$ dotnet format -v diag
The dotnet runtime version is '6.0.2'.
The dotnet CLI version is '6.0.200'.
Using MSBuild.exe located in '/usr/src/dotnet-sdk-6.0.2/sdk/6.0.200/'.
Formatting code files in workspace '/home/lunar/Code/Lunar/Tomoe/Tomoe.csproj'.
Loading workspace.
Determining projects to restore...
All projects are up-to-date for restore.
Project Tomoe is using configuration from '/home/lunar/Code/Lunar/Tomoe/.editorconfig'.
Project Tomoe is using configuration from '/home/lunar/Code/Lunar/Tomoe/Migrations/.editorconfig'.
Project Tomoe is using configuration from '/home/lunar/Code/Lunar/Tomoe/obj/Debug/net6.0/Tomoe.GeneratedMSBuildEditorConfig.editorconfig'.
Project Tomoe is using configuration from '/usr/src/dotnet-sdk-6.0.2/sdk/6.0.200/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_6_default.editorconfig'.
Complete in 3209ms.
Determining formattable files.
Complete in 778ms.
Running formatters.
Running Code Style analysis.
Determining diagnostics...
Running 79 analyzers on Tomoe.
Complete in 4126ms.
Fixing diagnostics...
Complete in 5ms.
Analysis complete in 4131ms.
// This is repeated 253 times.
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
// End repeat
Unhandled exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerFinderHelpers.<>c.<LoadAnalyzersAndFixers>b__0_0(Assembly assembly)
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.OfTypeIterator[TResult](IEnumerable source)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
at System.Collections.Immutable.ImmutableArray.ToImmutableArray[TSource](IEnumerable`1 items)
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerFinderHelpers.LoadAnalyzersAndFixers(IEnumerable`1 assemblies)
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerReferenceInformationProvider.GetAnalyzersAndFixers(Project project)
at System.Collections.Immutable.ImmutableDictionary.<>c__DisplayClass9_0`3.<ToImmutableDictionary>b__0(TSource element)
at System.Linq.Utilities.<>c__DisplayClass2_0`3.<CombineSelectors>b__0(TSource x)
at System.Linq.Enumerable.SelectIListIterator`2.MoveNext()
at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 items, MutationInput origin, KeyCollisionBehavior collisionBehavior)
at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 pairs, Boolean avoidToHashMap)
at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 pairs)
at System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary[TSource,TKey,TValue](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 keyComparer, IEqualityComparer`1 valueComparer)
at System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary[TSource,TKey,TValue](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerReferenceInformationProvider.GetAnalyzersAndFixers(Solution solution, FormatOptions formatOptions, ILogger logger)
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerFormatter.FormatAsync(Solution solution, ImmutableArray`1 formattableDocuments, FormatOptions formatOptions, ILogger logger, List`1 formattedFiles, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.CodeFormatter.RunCodeFormattersAsync(Solution solution, ImmutableArray`1 formattableDocuments, FormatOptions formatOptions, ILogger logger, List`1 formattedFiles, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.CodeFormatter.FormatWorkspaceAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken, String binaryLogPath)
at Microsoft.CodeAnalysis.Tools.FormatCommandCommon.FormatAsync(FormatOptions formatOptions, ILogger`1 logger, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.Commands.RootFormatCommand.FormatCommandDefaultHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass27_0.<<UseVersionOption>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__24_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseDebugDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseExceptionHandler>b__0>d.MoveNext()
// This is repeated 253 times.
System.IO.FileNotFoundException:
File name: 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
// End repeat
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
[lunar@J-Laptop 03:04:04pm ~/Code/Lunar/Tomoe]$
Notes:
Apologies for the non-minimal repro, as I’m not sure what’s causing this in the first place. Additional apologies if this belongs in roslyn-analyzers instead of this repo. I didn’t see anything related to CAxxxx
, so I’m assuming this belongs here.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:20
- Comments:28 (5 by maintainers)
Top Results From Across the Web
Could not load file or assembly 'Microsoft.CodeAnalysis ...
An error message comes up saying the following: Could not load file or assembly 'Microsoft.CodeAnalysis, version= 1.3.1.0, Culture=neutral, ...
Read more >Could not load file or assembly 'Microsoft.CodeAnalysis ...
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
Read more >C# – Could not load file or assembly Microsoft.CodeAnalysis
FileLoadException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
Read more >Could not load file or assembly 'Microsoft.CodeAnalysis ...
Coding example for the question Could not load file or assembly 'Microsoft.CodeAnalysis, version= 1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ...
Read more >Versions of source generator dependencies - Damir's Corner
Generator.dll : Could not load file or assembly Microsoft.CodeAnalysis, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 or ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We have the same issue in github actions. The same commit yesterday had passed
dotnet format --verify-no-changes
, but today it failed withI am getting this issue but for 4.5.0.0 in .NET 7.0.202.