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

Add import null reference exception #48967

Merged
4 commits merged into from
Oct 30, 2020
Merged

Conversation

davidwengier
Copy link
Contributor

Fixes #48891

I couldn't get a repro of this, but its a fairly obvious fix. See comments below.

First commit annotates, second commit fixes the bug.

@davidwengier davidwengier requested a review from a team as a code owner October 28, 2020 03:22
{
var awaitExpression = FirstAwaitExpressionAncestor(syntaxFactsService, node);

var innerExpression = syntaxFactsService.GetExpressionOfAwaitExpression(awaitExpression);

if (innerExpression is null)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a bonus fix. Callers to GetAwaitInfo already handle when it returns null.

{
var collectionExpression = FirstForeachCollectionExpressionAncestor(syntaxFactsService, node);

if (collectionExpression is null)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the real fix. Callers to GetCollectionExpressionType already handle when it returns null.

Copy link
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

Fix looks good.

@davidwengier Did we have any heap dumps of the failure?

@davidwengier
Copy link
Contributor Author

Did we have any heap dumps of the failure?

No, I think @tmat just hit it randomly yesterday.

@davidwengier davidwengier requested a review from a team as a code owner October 30, 2020 03:11
@ghost
Copy link

ghost commented Oct 30, 2020

Hello @davidwengier!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Auto-approval

@ghost ghost merged commit accabb0 into dotnet:master Oct 30, 2020
@ghost ghost added this to the Next milestone Oct 30, 2020
@allisonchou allisonchou modified the milestones: Next, 16.9.P2 Nov 24, 2020
@davidwengier davidwengier deleted the AddImportNRE branch January 11, 2021 05:41
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ArgumentNullException from AbstractAddImportFeatureService`1.GetCollectionExpressionType
3 participants