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 null checks in AwaitExpressionInfo #32062

Merged
merged 3 commits into from
Jan 1, 2019
Merged

Conversation

jcouv
Copy link
Member

@jcouv jcouv commented Dec 30, 2018

@jcouv jcouv added this to the 16.0.P2 milestone Dec 30, 2018
@jcouv jcouv self-assigned this Dec 30, 2018
@jcouv jcouv requested a review from a team as a code owner December 30, 2018 18:46
@cston
Copy link
Member

cston commented Dec 31, 2018

        return Hash.Combine(GetAwaiterMethod, Hash.Combine(IsCompletedProperty, GetResultMethod.GetHashCode()));

Will this fail with default(AwaitExpressionInfo)?


Refers to: src/Compilers/CSharp/Portable/Compilation/AwaitExpressionInfo.cs:44 in 6f98b20. [](commit_id = 6f98b20, deletion_comment = False)

@jcouv
Copy link
Member Author

jcouv commented Dec 31, 2018

Indeed. GetHashCode still had a null bug. Thanks!

if (_awaitableInfo is null)
{
return 0;
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: while you're here could change the Equals implementation to use pattern matching and avoid the double cast.

@jcouv jcouv merged commit 94661ea into dotnet:master Jan 1, 2019
@jcouv jcouv deleted the get-awaiter branch January 1, 2019 23:33
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.

3 participants