Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All analyzers from assembly Microsoft.CodeAnalysis.CodeStyle.Fixes failed to load: Unable to load one or more of the requested types. Method not found: 'Boolean Microsoft.CodeAnalysis.IParameterSymbol.get_IsParamsArray()'. #73508

Closed
bertenbobje opened this issue May 16, 2024 · 5 comments
Assignees
Milestone

Comments

@bertenbobje
Copy link

Version Used:
.NET SDK 8.0.300
Steps to Reproduce:

  1. Have a .NET 8 project open
  2. Check the Roslyn Analyzer logs
  3. See that no projects were able to load due to the error below

A minimal repro, with source-code provided, is ideal. Using sharplab is preferred for compiler/language issues whenever possible.

Diagnostic Id: All analyzers from assembly Microsoft.CodeAnalysis.CodeStyle.Fixes failed to load: Unable to load one or more of the requested types. Method not found: 'Boolean Microsoft.CodeAnalysis.IParameterSymbol.get_IsParamsArray()'.

If this is a report about a bug in an analyzer, please include the diagnostic ID and message if possible (e.g. "IDE0030: Use coalesce expression").

Expected Behavior:
Roslyn loading for the projects.

Actual Behavior:
Roslyn not loading for projects.

@VahidN
Copy link

VahidN commented May 18, 2024

Yes, I have lots of similar error messages with .NET SDK 8.0.300

Analyzer 'Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryLambdaExpression.CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer' threw an exception of type 'System.TypeLoadException' with message 'Could not load type 'Microsoft.CodeAnalysis.SeparatedSyntaxList' from assembly 'Microsoft.CodeAnalysis, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.'.
System.TypeLoadException: Could not load type 'Microsoft.CodeAnalysis.SeparatedSyntaxList' from assembly 'Microsoft.CodeAnalysis, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
   at Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryLambdaExpression.CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.GetParameters(AnonymousFunctionExpressionSyntax expression)
   at Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryLambdaExpression.CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.AnalyzeSyntax(SyntaxNodeAnalysisContext context, INamedTypeSymbol expressionType, INamedTypeSymbol conditionalAttributeType)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken) in Z:\BuildAgent\work\3b7ce003563d6f8f\src\Compilers\Core\Portable\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 1185
-----
Suppress the following diagnostics to disable this analyzer: IDE0200

@roemba
Copy link

roemba commented May 29, 2024

Can confirm this problem still persists with SDK version 8.0.301

@solo12zw74
Copy link

Got that in JetBrains Rider IDE, whereas the Visual Studio 2022 works well. And that actually starts after Visual Studio update. I suppose it updates .NET SDK "by the way".

@solo12zw74
Copy link

solo12zw74 commented May 29, 2024

What helps me as workaround:

  1. Manually install .NET 8.0.206 with winget install --id Microsoft.DotNet.Sdk.8 --version 8.0.206
  2. Create a global.json file in repo root with the following:
{
  "sdk": {
    "version": "8.0.206",
    "allowPrerelease": false
  }
}

Seems like Visual Studio Installer remove globally installed previous version (8.0.206) of .NET SDK

@sharwell
Copy link
Member

Duplicate of #72811

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants