-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
?. operator and await question (potential bug) #36310
Comments
Think of the offending line as being interpreted as something like |
That is correct and clear but still very inconsistent with code without await. I would personally prefer to not have await? and change current behaviour, otherwise we add one more inconsistenly on top of existing inconsistency. Like imagine you had code await? foo.Bar() and then for some reason function become sync and await has gone. Then we can't simply delete await? and have to change code from await? foo.Bar() to foo?.Bar(). Does not look good IMHO |
You would still need to write |
Ah, now Is clear. is that something already discussed and agreed? Just interesting if this might go to any version soon? |
Hi Guys!
Have a look at following sample:
Here when I call Bar I use ?. operator and expect method to not be called and it is not called and no exception thrown. Right on the next line I expect exactly the same behaviour but I do get NullReferenceException. Is that something expected? (If it is then I would say it looks very inconsistent)
VS 2019 16.1.1
C# Latest Minor
Thank you
The text was updated successfully, but these errors were encountered: