Skip to content

C#: Account for bogus nullness information from the extractor - #23322

Merged
hvitved merged 1 commit into
github:mainfrom
hvitved:csharp/guards-non-null-roslyn-fix
Dec 2, 2026
Merged

hvitved merged 1 commit into
github:mainfrom
hvitved:csharp/guards-non-null-roslyn-fix

Conversation

@hvitved

@hvitved hvitved commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

DCA is fine.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Combining extractor flow states with recursive SSA null inference introduces interacting effects on shared guard implications and downstream nullness classifications that warrant human review.

No open issues 🎉

What changed in this PR

This PR makes C# nullness analysis reject extractor-provided non-null information when the expression is known to be null.

Changes:

  • Guard non-null flow-state inference with not nullValueImplied(e).
  • Update test expectations to remove three incorrect non-null results.
File Description
csharp/​ql/​test/​library-tests/​controlflow/​guards/​AbstractValue.expected Remove incorrect non-null expectations.
csharp/​ql/​lib/​semmle/​code/​csharp/​controlflow/​Guards.qll Reject contradictory extractor nullness information.

Review effort: Balanced (adaptive)

@hvitved
hvitved force-pushed the csharp/guards-non-null-roslyn-fix branch from fa41ed3 to 4aebbac Compare December 2, 2026 10:53
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Dec 2, 2026
@hvitved
hvitved marked this pull request as ready for review December 2, 2026 14:20
@hvitved
hvitved requested a review from a team as a code owner December 2, 2026 14:20

@michaelnebel michaelnebel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hvitved
hvitved merged commit 78193ee into github:main Dec 2, 2026
26 checks passed
@hvitved
hvitved deleted the csharp/guards-non-null-roslyn-fix branch December 2, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C# no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants