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
s.Length should result in a warning:
s.Length
[System.Runtime.CompilerServices.NonNullTypes] class C { static void MayThrow() { throw null; } static int F() { string? s = ""; try { s = null; MayThrow(); s = ""; } catch (System.Exception) { } return s.Length; // warning: possibly null } }
Reported by @gafter.
The text was updated successfully, but these errors were encountered:
Here is a much simpler example demonstrating the shortcomings of our analysis of try-finally:
[module: System.Runtime.CompilerServices.NonNullTypes(true)] public static class Program { public static void Main() { string? s = ""; try { } finally { s = null; } _ = s.Length; // warning missing } }
Sorry, something went wrong.
Track nullable state in try statements
c82b425
Fixes dotnet#30561
Track nullable state in try statements (#31082)
69e0571
Fixes #30561
Fixed in #31082
gafter
No branches or pull requests
s.Length
should result in a warning:Reported by @gafter.
The text was updated successfully, but these errors were encountered: