dotnet/roslyn
GitHub で見るNRE from VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer when working in Roslyn.sln
Open
#77,134 opened on 2025年2月10日
Area-AnalyzersFeature - IDE0004help wanted
Repository metrics
- Stars
- (20,414 stars)
- PR merge metrics
- (平均マージ 6d 17h) (30d で 256 merged PRs)
説明
Analyzer 'Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryCast.VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.
Exception occurred with following context:
Compilation: Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests
SyntaxTree: C:\R1\src\Compilers\VisualBasic\Test\Emit\ExpressionTrees\Sources\QueryHelper.vb
SyntaxNode: DirectCast(Nothing, QueryHelper ... [DirectCastExpressionSyntax]@[1442..1480) (29,67)-(29,105)
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.CodeAnalysis.VisualBasic.Extensions.CastAnalyzer.CastPassedToParamArrayDefinitelyCantBeRemoved(ITypeSymbol castType)
at Microsoft.CodeAnalysis.VisualBasic.Extensions.CastAnalyzer.IsUnnecessary()
at Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryCast.VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer.IsUnnecessaryCast(SemanticModel model, ExpressionSyntax node, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.RemoveUnnecessaryCast.AbstractRemoveUnnecessaryCastDiagnosticAnalyzer`2.TryRemoveCastExpression(SemanticModel model, TCastExpression node, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.RemoveUnnecessaryCast.AbstractRemoveUnnecessaryCastDiagnosticAnalyzer`2.AnalyzeSyntax(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: IDE0004