Skip to content

Fix RCS1249 for non-null nullable flow states - #1834

Open
elkampu wants to merge 2 commits into
dotnet:mainfrom
elkampu:fix/rcs1249-non-null-flow-state
Open

Fix RCS1249 for non-null nullable flow states#1834
elkampu wants to merge 2 commits into
dotnet:mainfrom
elkampu:fix/rcs1249-non-null-flow-state

Conversation

@elkampu

@elkampu elkampu commented Sep 4, 2026

Copy link
Copy Markdown

Summary

  • evaluate the operand without its null-forgiving operator so RCS1249 sees the original nullable flow state
  • report redundant suppression for literals, object creation, non-null members, and values proven non-null by control flow
  • preserve the existing nullable-argument and initializer behavior, with negative coverage for values that may still be null

Fixes #1659

Test plan

  • RCS1249 focused tests: 11 passed
  • full Analyzers.Tests suite: 2,199 passed
  • RCS1249 tests against Roslyn 4.7: 11 passed
  • full Roslynator.sln build: 0 warnings, 0 errors
  • changed-file formatting and git diff --check

@elkampu

elkampu commented Sep 4, 2026

Copy link
Copy Markdown
Author

@dotnet-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RCS1249 - Not working in some cases

1 participant