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
Fix S1905 FP: Nullability context and array of anonymous types #6438
Labels
Area: C#
C# rules related issues.
Sprint: Hardening
Short-lived label (that will live long due to reusability)
Type: False Positive
Rule IS triggered when it shouldn't be.
Projects
Milestone
Comments
Hello, again @paulhickman-a365, and thanks for opening this issue. Your feedback helps us improve our products. We will look at it as soon as possible. After we confirm the issue, we will add labels and put it in our backlog |
Thank you for reporting this, I confirm it as FP. It also reproduces with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: C#
C# rules related issues.
Sprint: Hardening
Short-lived label (that will live long due to reusability)
Type: False Positive
Rule IS triggered when it shouldn't be.
Description
In a .net 6 project where nullable reference types is enabled, in the example below the casts to string? are necessary, otherwise the nullability of x in the two array elements doesn't match and this produces a CS8206 error
Repro steps
Expected behavior
No S1905 warning is produced
Actual behavior
S1905 warning is produced
Known workarounds
Don't use anonymous types and create a class with a property x of type string? and declare the array of that type
Related information
The text was updated successfully, but these errors were encountered: