We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
There should be no warning in the following, since s is string only matches if s isn't null.
s is string
s
null
using System; public class C { public void M(string? s) { if (s is string) { s.ToString(); // warning CS8602: Possible dereference of a null reference. } } }
Conversely, s is null should also inform nullability. Also, s = null!.
s is null
s = null!
(update: split the null-coalesing issue into separate issue: #26747)
Once fixed, please update this speclet section.
Tagging @cston @gafter
The text was updated successfully, but these errors were encountered:
See also #26737.
Sorry, something went wrong.
Closing this issue as dupe of #26737, and added a note there about s is null scenario.
No branches or pull requests
There should be no warning in the following, since
s is string
only matches ifs
isn'tnull
.Conversely,
s is null
should also inform nullability.Also,
s = null!
.(update: split the null-coalesing issue into separate issue: #26747)
Once fixed, please update this speclet section.
Tagging @cston @gafter
The text was updated successfully, but these errors were encountered: