`--fix-analyzers` is broken on .NET 6
See original GitHub issueShows the following error:
Unhandled exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Could not load type 'Microsoft.CodeAnalysis.IIncrementalGenerator' from assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.CodeAnalysis.SourceProductionContext' from assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.CodeAnalysis.SourceProductionContext' from assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.CodeAnalysis.SourceProductionContext' from assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
...
<some more similar errors>
Steps to reproduce:
mkdir TestProject
cd TestProject
dotnet new console
dotnet new tool-manifest
dotnet tool install dotnet-format
dotnet tool run dotnet-format --fix-analyzers
Tested on .NET 6.0 Debian and Alpine Docker images
EDIT: Also seems to be broken on Windows (tested in 6.0-nanoserver-20H2
Docker image)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:14
- Comments:25 (8 by maintainers)
Top Results From Across the Web
Microsoft.CodeAnalysis problem
Hello, I am receiving these suspisious waringns. Can someone help ? 1>CSC : warning CS8032: An instance of analyzer Microsoft.CodeAnalysis.
Read more >CS8032 warning with Microsoft.CodeAnalysis out of no ...
I had a similar problem. Running on .net6 but with a transitive nuget dependency on an older version of Microsoft.CodeAnalysis.CSharp.
Read more >Analyzers for ASP.NET Core in .NET 6
In this post I look at the analyzers that come built in with ASP.NET Core, including updates to existing analyzers, and new minimal...
Read more >Migrating to .NET 6 : r/dotnet
After hitting an issue on my .NET 5 project, I decided to update to the .NET 6 framework. However, the proj file enables...
Read more >dotnet - How do I fix my broken .NET 6 installation?
Step 1: Uninstall https://askubuntu.com/a/1386715/231561. Step 2: Set props in preferences.d https://stackoverflow.com/a/73899341/16454.
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
@LorianColtof #1519 was closed and .NET 6.0.202 SDK has been released
A workaround until new SDKs are released would be to install dotnet-format as a global tool and invoke it with
dotnet-format
(the hyphen is important).If you are only using .NET 6 SDKs:
dotnet tool install -g dotnet-format --version "6.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json
If you are previewing .NET 7 SDKs:
dotnet tool install -g dotnet-format --version "7.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json