-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
The following ternary statement causes an exception to be thrown by this analyzer. You can find the surrounding context here.
HasSufficientMembers(raw)
? new Scaffolder(raw).Result
: null;Judging by the error, this should be enough information to fix the issue, but do let me know if you require me to create an MRE (Minimal Reproducible Example) otherwise:
CSC : warning AD0001: Analyzer 'Asyncify.VariableAccessAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.MethodSymbol' to type 'Microsoft.CodeAnalysis.ILocalSymbol'.'. [/home/emik/RiderProjects/Emik.SourceGenerators.Choices/Emik.SourceGenerators.Choices.csproj]
Exception occurred with following context:
Compilation: Emik.SourceGenerators.Choices
SyntaxTree: /media/f/RiderProjects/Emik.SourceGenerators.Choices/Source/ExtendingGenerator.cs
SyntaxNode: new Scaffolder(raw).Result [MemberAccessExpressionSyntax]@[3158..3184) (51,14)-(51,40)
System.InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.MethodSymbol' to type 'Microsoft.CodeAnalysis.ILocalSymbol'.
at Asyncify.VariableAccessChecker.FindSymbol(ExpressionSyntax expression)
at Asyncify.VariableAccessChecker.ShouldUseTap(MemberAccessExpressionSyntax memberAccessExpression)
at Asyncify.VariableAccessAnalyzer.CheckMemberAccess(SyntaxNodeAnalysisContext context)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken)
-----
Suppress the following diagnostics to disable this analyzer: AsyncifyVariable
Thanks for taking the time in reading my issue!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels