Analyzer 'System.Runtime.Analyzers.CSharpAvoidZeroLengthArrayAllocationsAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Specified cast is not valid.'. #850
Severity Code Description Project File Line Source Tool Detail Description
Error AD0001 Analyzer 'System.Runtime.Analyzers.CSharpAvoidZeroLengthArrayAllocationsAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Specified cast is not valid.'. CSharpScriptingTest.Desktop 1 IntelliSense System.Runtime.CSharp.Analyzers Analyzer 'System.Runtime.Analyzers.CSharpAvoidZeroLengthArrayAllocationsAnalyzer' threw the following exception:
'Exception occurred with following context:
Compilation: Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests
IOperation: ArrayCreationExpression
SyntaxTree: C:\roslyn-internal\Open\src\Scripting\CSharpTest.Desktop\ObjectFormatterTests.cs
SyntaxNode: "Hashtable(1)" [LiteralExpressionSyntax]@[1327..1341) (37,31)-(37,45)
System.InvalidCastException: Specified cast is not valid.
at System.Runtime.Analyzers.AvoidZeroLengthArrayAllocationsAnalyzer.AnalyzeOperation(OperationAnalysisContext context) in C:\roslyn-analyzers\src\System.Runtime.Analyzers\Core\AvoidZeroLengthArrayAllocations.cs:line 75
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass43_1.<ExecuteOperationAction>b__1()
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock(DiagnosticAnalyzer analyzer, Action analyze, Nullable`1 info)
-----
'.
This is showing up when trying to move Roslyn.sln to new analyzer packages. Need to re-enable this rule on Roslyn.sln once this issue is fixed and Roslyn moves to newer analyzer packages.
Got the following AD0001 in the error list: