dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.69k stars 1.06k forks source link

[dotnet format] CSharpFormattingCodeFixProvider and CSharpRemoveUnnecessaryImportsCodeFixProvider code fixes fail with .NET 9 preview 3 #40174

Open martincostello opened 6 months ago

martincostello commented 6 months ago

Describe the bug

Running dotnet format for .NET 9 preview 3 outputs errors similar to the following:

Failed to apply code fix CSharpRemoveUnnecessaryImportsCodeFixProvider for IDE0005: Unable to load one or more of the requested types.
Method not found: 'Boolean Microsoft.CodeAnalysis.IParameterSymbol.get_IsParamsArray()'.

To Reproduce

  1. Clone https://github.com/martincostello/dotnet-bumper/commit/0560615d1039da8f767d68585d6237c16655fb8f.
  2. Run dotnet format from the root of the repostory.

Exceptions (if any)

❯ dotnet format
Failed to apply code fix CSharpFormattingCodeFixProvider for IDE0055: Unable to load one or more of the requested types.
Method not found: 'Boolean Microsoft.CodeAnalysis.IParameterSymbol.get_IsParamsArray()'.
Failed to apply code fix CSharpFormattingCodeFixProvider for IDE0055: Unable to load one or more of the requested types.
Method not found: 'Boolean Microsoft.CodeAnalysis.IParameterSymbol.get_IsParamsArray()'.
Failed to apply code fix CSharpFormattingCodeFixProvider for IDE0055: Unable to load one or more of the requested types.
Method not found: 'Boolean Microsoft.CodeAnalysis.IParameterSymbol.get_IsParamsArray()'.
Failed to apply code fix CSharpFormattingCodeFixProvider for IDE0055: Unable to load one or more of the requested types.
Method not found: 'Boolean Microsoft.CodeAnalysis.IParameterSymbol.get_IsParamsArray()'.
Failed to apply code fix CSharpFormattingCodeFixProvider for IDE0055: Unable to load one or more of the requested types.
Method not found: 'Boolean Microsoft.CodeAnalysis.IParameterSymbol.get_IsParamsArray()'.
Failed to apply code fix CSharpFormattingCodeFixProvider for IDE0055: Unable to load one or more of the requested types.
Method not found: 'Boolean Microsoft.CodeAnalysis.IParameterSymbol.get_IsParamsArray()'.
Failed to apply code fix CSharpFormattingCodeFixProvider for IDE0055: Unable to load one or more of the requested types.
Method not found: 'Boolean Microsoft.CodeAnalysis.IParameterSymbol.get_IsParamsArray()'.

Further technical details

.NET SDK 9.0.100-preview.3.24204.13

dotnet-issue-labeler[bot] commented 6 months ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

martincostello commented 6 months ago

Maybe a dependency issue related to this: https://github.com/dotnet/roslyn/issues/71816

bertenbobje commented 5 months ago

This issue is happening for me as well when I update to .NET SDK 8.0.300. Downgrading back to 8.0.205 solves it.

Opened a new issue (https://github.com/dotnet/roslyn/issues/73508)