question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`--fix-analyzers` is broken on .NET 6

See original GitHub issue

Shows 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:closed
  • Created 2 years ago
  • Reactions:14
  • Comments:25 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
ciastooocommented, Apr 15, 2022

@LorianColtof #1519 was closed and .NET 6.0.202 SDK has been released

4reactions
JoeRobichcommented, Mar 1, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found