You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The rule DotNotOverwriteCollectionElements fails with NRE.
StackTrace is:
Warning AD0001 Analyzer 'SonarAnalyzer.Rules.VisualBasic.DoNotOverwriteCollectionElements' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'. ConsoleApp1 1 Active Analyzer 'SonarAnalyzer.Rules.VisualBasic.DoNotOverwriteCollectionElements' threw the following exception:
'Exception occurred with following context:
Compilation: ConsoleApp1
SyntaxTree: C:\Users\Amaury Leve\Source\Repos\ConsoleApp6\ConsoleApp1\Module1.vb
SyntaxNode: C [ExpressionStatementSyntax]@[65..66) (8,0)-(8,1)
System.NullReferenceException: Object reference not set to an instance of an object.
at SonarAnalyzer.Rules.VisualBasic.DoNotOverwriteCollectionElements.GetFirstArgumentExpression(InvocationExpressionSyntax invocation)
at SonarAnalyzer.Rules.VisualBasic.DoNotOverwriteCollectionElements.GetIndexOrKey(StatementSyntax statement)
at SonarAnalyzer.Rules.DoNotOverwriteCollectionElementsBase`1.AnalysisAction(SyntaxNodeAnalysisContext context)
at SonarAnalyzer.Helpers.DiagnosticAnalyzerContextHelper.<>c__DisplayClass0_0`1.<RegisterSyntaxNodeActionInNonGenerated>b__0(SyntaxNodeAnalysisContext c)
at SonarAnalyzer.Helpers.SonarAnalysisContext.<>c__DisplayClass21_0`1.<RegisterContextAction>b__0(TContext c)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__44`1.<ExecuteSyntaxNodeAction>b__44_0(ValueTuple`2 data)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info)
Repro steps
ModuleModule1SubMain()Dimf1=NewFooDimf2=NewFoof1.Attributes.Item("Title")="some text goes here"f2.Attributes.Item("Title")="some other text goes here"EndSubEndModuleClassFooPublicAttributesAsDictionary(OfString,String)EndClass
Related information
SonarAnalyzer.VisualBasic 7.10
The text was updated successfully, but these errors were encountered:
Module NullReferenceReproducer
Sub Main()
Bar ' AD0001 NullReferenceException in GetFirstArgumentExpression
End Sub
Public Sub Bar()
End Sub
End Module
Description
The rule
DotNotOverwriteCollectionElements
fails with NRE.StackTrace is:
Repro steps
Related information
The text was updated successfully, but these errors were encountered: