soft person

Automating creativity

Features

Analysis Capabilities

What NStatic can find

Six categories of bugs that escape every other .NET static analyzer — found symbolically, not by pattern matching.

Category 01

Exception Analysis

NStatic tracks exceptions as first-class values in its symbolic model. An expression that might throw becomes If(condition, result, Exception(…)) — allowing the analyzer to determine whether any execution path can reach a thrown exception uncaught.

  • System exceptions: NullReferenceException,IndexOutOfRangeException, DivideByZeroException,OverflowException, StackOverflowException
  • Framework library exceptions — NStatic interprets .NET Framework IL directly to model what String.ToCharArray, List<T>.Add, and hundreds of other methods can throw
  • User-defined exceptions — tracked through throw/catch/finally chains symbolically
  • Failing assertions — Debug.Assert conditions verified; failures surfaced as findings

When an uncaught exception is found, NStatic shows the full interprocedural call stack and the symbolic condition under which it occurs.

Error highlighting in source editor
Error list showing exception findings

Category 02

Dead Code Detection

Code that can never execute isn't just untested — it's a maintenance hazard that confuses future readers and bloats the binary. NStatic identifies unreachable code through symbolic path analysis rather than simple control-flow heuristics.

  • Statements that follow unconditional throws or returns
  • Catch blocks for exceptions that cannot be thrown on any path reaching the try block
  • Branches of if or switch that the symbolic model proves unreachable
  • Methods whose return value is always an exception expression (they never return normally)
Execution paths showing dead branch

Category 03

Redundant Code

Redundant code compiles and runs — it just doesn't do anything useful. These findings point to logic errors, copy-paste mistakes, or stale code that should have been removed.

  • Always-true or always-false conditions in if, while, and ternary expressions
  • Contradictory conditions that can never be simultaneously true
  • Assignments to a variable that is immediately overwritten before being read
  • Method parameters that don't affect the return value (useless parameters)
  • Calls to methods with constant return values (calls that could be replaced with a literal)
  • Infinite loops with no reachable exit condition
Assumptions showing always-true condition

Category 04

Null Analysis

Null references are .NET's most common runtime crash. NStatic tracks nullability through the symbolic model — no [NotNull] or [CanBeNull] attributes needed. The analysis infers nullability from code, assignments, conditional branches, and method return types.

  • Definite null dereferences: a field access or method call on an expression the model proves is null
  • Conditional null dereferences: the model shows null is possible on some paths
  • Null propagation through call chains, tracked interprocedurally
  • Redundant null checks: conditions like if (x == null) wherex cannot be null
Locals panel showing null tracking

Category 05

Bounds and Range Violations

Array index out of bounds is a direct cause of IndexOutOfRangeException. NStatic models array lengths and index values symbolically, including loops that iterate over collections — which it solves to closed form rather than unrolling.

  • Array access with an index that the symbolic model shows can exceed the array length
  • Off-by-one errors in loop bounds — detected by solving the loop's closed-form expression
  • Negative index accesses
  • Collection accesses (List, Dictionary) with validated range models
Loop bounds solved symbolically

Category 06

Equivalence Detection

When two expressions in your code always produce the same value, NStatic can identify the opportunity for simplification. This category surfaces refactoring hints and occasionally reveals deeper logic errors where two different-looking computations were expected to diverge but don't.

  • Two branches of an if that produce identical results (the branch is redundant)
  • A computed value that always equals a constant or simpler expression
  • Duplicate sub-expressions that could be extracted to a shared variable
Equation solving showing equivalent expressions

Feature preview

Diagnostics that explain behavior, not just syntax.

NStatic is designed to surface the symbolic facts behind a warning: which call path reached it, which assumptions mattered, and what values were known at the point of failure.

Exception analysis

Infer conditions that guarantee or permit exceptions, including framework parameter validation and custom exception messages when available.

NStatic execution path view highlighting a possible error path
Interprocedural traces

Follow warnings through method calls and present a call stack that makes cross-method reasoning understandable.

NStatic call stack view
Symbolic locals

Inspect locals and object state in terms of original inputs, conditionals, method summaries, and simplified expressions.

NStatic locals window with symbolic values
Loop reasoning

Represent loop updates as symbolic functions or recurrences where possible, instead of only unrolling a fixed number of times.

NStatic loop locals showing symbolic values for loop-created objects

Specifications

NStatic's planned specification syntax uses analysis comments so teams can add assertions, assumptions, old-value references, and breakpoints while preserving normal C# source compatibility.

C# code with NStatic specification comments highlighted
Specification comments are treated as analysis syntax by NStatic and ordinary comments by the C# compiler.

assert and assume

Check facts or introduce path facts for the analyzer to use later.

old and result

Relate post-state values to method-entry values and return values.

breakpoint

Create symbolic inspection points without running the program on concrete inputs.

Intrigued?

Join the waitlist and be first to try NStatic when it ships for Visual Studio.

Join the Waitlist