-
-
Notifications
You must be signed in to change notification settings - Fork 256
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
Declare as nullable code fix for CS8600 breaks when casts are involved #1392
Labels
Comments
Currently attempting a fix. |
jroessel
added a commit
to jroessel/roslynator
that referenced
this issue
Feb 13, 2024
…ions Casting a nullable type to a non-nullable type within a variable declaration no longer ignores the cast type and also no longer changes `var` to `var?`. Fixes dotnet#1392.
jroessel
added a commit
to jroessel/roslynator
that referenced
this issue
Feb 13, 2024
…ions Casting a nullable type to a non-nullable type within a variable declaration no longer ignores the cast type and also no longer changes `var` to `var?`. Fixes dotnet#1392.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Product and Version Used:
Steps to Reproduce:
The following code reports CS8600 because we cast a nullable type to a non-nullable type as part of a variable declaration.
Roslynator's code fix for CS8600 erroneously assumes the declaration type to be the problem, when it's actually the cast. So we don't get rid of the warning and in case of
var
actually introduce broken code.Actual Behavior:
Expected Behavior:
(Although in case of (2) the declaration could be adjusted by another code fix for the same diagnostic, so at least iteratively applying fixes will arrive at the same result.)
The text was updated successfully, but these errors were encountered: