C# · Roslyn · static analysis · data-flow

DerefAfterNullAnalyzer

The analyzer must detect potentially unsafe dereferences after a possible null while accounting for branches, loops, and control-flow joins.

01

Problem

The analyzer must detect potentially unsafe dereferences after a possible null while accounting for branches, loops, and control-flow joins.

02

Constraints

The analysis must converge correctly across branches, loops, and join points without path explosion.

03

Solution

Roslyn ControlFlowGraph with forward fixed-point data-flow analysis: Unknown/MaybeNull/NotNull states propagate across basic blocks and merge at join points.

04

Outcome

Diagnostics for potentially unsafe dereference paths over the real CFG, with successor reprocessing until the data-flow state reaches a fixed point.

05

Verification

Analyzer tests plus fixed-point worklist convergence over the Roslyn CFG, including branches and loops.

06

My ownership

CFG/data-flow implementation, merge logic, diagnostics, and analyzer tests.