Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AD0001 for CA2009 - System.InvalidCastException #6476

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

Evangelink
Copy link
Member

Fixes the following AD0001

Analyzer 'Microsoft.NetCore.Analyzers.ImmutableCollections.DoNotCallToImmutableCollectionOnAnImmutableCollectionValueAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.ArrayTypeSymbol' to type 'Microsoft.CodeAnalysis.INamedTypeSymbol'.'.
Exception occurred with following context:
Compilation: <redacted>
IOperation: Invocation
SyntaxTree: <redacted>
SyntaxNode: new[] { typeof(<redacted>... [InvocationExpressionSyntax]@[1339..1403) (33,10)-(33,74)

System.InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.ArrayTypeSymbol' to type 'Microsoft.CodeAnalysis.INamedTypeSymbol'.
   at Microsoft.NetCore.Analyzers.ImmutableCollections.DoNotCallToImmutableCollectionOnAnImmutableCollectionValueAnalyzer.<>c__DisplayClass10_0.<Initialize>b__1(OperationAnalysisContext operationContext)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c.<ExecuteOperationAction>b__63_0(ValueTuple`2 data)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info)

@Evangelink Evangelink requested a review from a team as a code owner February 3, 2023 14:36
@codecov
Copy link

codecov bot commented Feb 3, 2023

Codecov Report

Merging #6476 (991cee4) into main (5802d3a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6476   +/-   ##
=======================================
  Coverage   96.15%   96.15%           
=======================================
  Files        1374     1374           
  Lines      319075   319086   +11     
  Branches    10333    10333           
=======================================
+ Hits       306801   306818   +17     
+ Misses       9818     9816    -2     
+ Partials     2456     2452    -4     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants