Skip to content

IndexOutOfRangeException in UseConcreteTypeAnalyzer (CA1859) #6852

@mavasani

Description

@mavasani

Analyzer

Diagnostic ID: CA1859: Use concrete types when possible for improved performance

Analyzer source

SDK: Built-in CA analyzers in .NET 8 SDK or later

Version: SDK 8.0.0-preview.23364.2

AD0001 analyzer exception diagnostic

Exception seen while working on Roslyn.sln

Severity	Code	Description	Project	File	Line	Suppression State
Error	AD0001	Analyzer 'Microsoft.NetCore.Analyzers.Performance.UseConcreteTypeAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' with message 'Index was outside the bounds of the array.'.
Exception occurred with following context:
Compilation: Microsoft.CodeAnalysis.Workspaces
IOperation: Invocation
SyntaxTree: C:\roslyn\src\Workspaces\Core\Portable\Storage\SQLite\v2\SQLitePersistentStorage_Threading.cs
SyntaxNode: vt.Item1() [InvocationExpressionSyntax]@[3489..3499) (59,16)-(59,26)

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Analyzer.Utilities.AnalyzerOptionsExtensions.TryGetSyntaxTreeForOption(ISymbol symbol, SyntaxTree& tree)
   at Microsoft.NetCore.Analyzers.Performance.UseConcreteTypeAnalyzer.<>c__DisplayClass9_1.<Initialize>b__4(ISymbol symbol)
   at Microsoft.NetCore.Analyzers.Performance.UseConcreteTypeAnalyzer.Collector.HandleInvocation(IInvocationOperation op)
   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: CA1859	Microsoft.CodeAnalysis.Workspaces (netstandard2.0)	C:\roslyn\src\Workspaces\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj	1	Active

Metadata

Metadata

Assignees

Labels

Area-Microsoft.CodeAnalysis.NetAnalyzersBugThe product is not behaving according to its current intended designPriority:1Very important to release, not a ship blockerReliabilityIndicates a reliability issue (crash/data loss/test flakiness)

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions