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

Check for particular collection expr attribute by name, as it can be provided internally in packages #70179

Merged
merged 2 commits into from
Sep 29, 2023

Conversation

CyrusNajmabadi
Copy link
Member

Fixes #70178

Core issue here is that this attribute could jsut be internal, and included with a nuget package (like System.Collections.Immutable) to mark their types as supporting collection exprs. We should not assume there is a single well known attribute class that everyone will use.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner September 28, 2023 20:53
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 28, 2023
@@ -513,23 +512,20 @@ or ImplicitStackAllocArrayCreationExpressionSyntax
}

memberAccess = memberAccessExpression;
var createMethod = semanticModel.GetSymbolInfo(memberAccessExpression, cancellationToken).Symbol as IMethodSymbol;
if (createMethod is not { IsStatic: true })
if (semanticModel.GetSymbolInfo(memberAccessExpression, cancellationToken).Symbol is not IMethodSymbol { IsStatic: true } createMethod)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (semanticModel.GetSymbolInfo(memberAccessExpression, cancellationToken).Symbol is not IMethodSymbol { IsStatic: true } createMethod)
if (semanticModel.GetSymbolInfo(memberAccessExpression, cancellationToken).Symbol is not IMethodSymbol { IsStatic: true } createMethod)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NRE in CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer
4 participants