Skip to content

AD0001 (RCS1241) #1195

@gpuchtel

Description

@gpuchtel

I'm getting an error running Analyze -> Run Code Anlysis -> On Solution (See Below)

I am using:

Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.8.0 Preview 1.0

Roslynator Version 4.5.0


Severity Code Description Project File Line Suppression State Detail Description
Error AD0001 Analyzer 'Roslynator.CSharp.Analysis.NamedTypeSymbolAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.RecordDeclarationSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax'.'.
Exception occurred with following context:
Compilation: Core
ISymbol: Value (NamedType)

System.InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.RecordDeclarationSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax'.
at Roslynator.CSharp.Analysis.NamedTypeSymbolAnalyzer.ReportDiagnostic(SymbolAnalysisContext context, INamedTypeSymbol symbol, String interfaceName, String genericInterfaceName)
at Roslynator.CSharp.Analysis.NamedTypeSymbolAnalyzer.AnalyzeNamedType(SymbolAnalysisContext context)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action1 analyze, TArg argument, Nullable1 info, CancellationToken cancellationToken)

Suppress the following diagnostics to disable this analyzer: RCS1241 Core D:\Cybernetics\Core\Core.csproj 1 Active Analyzer 'Roslynator.CSharp.Analysis.NamedTypeSymbolAnalyzer' threw the following exception:
'Exception occurred with following context:
Compilation: Core
ISymbol: Value (NamedType)

System.InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.RecordDeclarationSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax'.
at Roslynator.CSharp.Analysis.NamedTypeSymbolAnalyzer.ReportDiagnostic(SymbolAnalysisContext context, INamedTypeSymbol symbol, String interfaceName, String genericInterfaceName)
at Roslynator.CSharp.Analysis.NamedTypeSymbolAnalyzer.AnalyzeNamedType(SymbolAnalysisContext context)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action1 analyze, TArg argument, Nullable1 info, CancellationToken cancellationToken)

'.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions