CodeQL library for C#
codeql/csharp-all 0.9.0 (changelog, source)
Search

Module Nullness

Provides predicates for performing nullness analyses.

Nullness analyses are used to identify places in a program where a null pointer exception (NullReferenceException) may be thrown. Example:

void M(string s) {
  if (s != null) {
    ...
  }
  ...
  var i = s.IndexOf('a'); // s may be null
  ...
}

Import path

import semmle.code.csharp.dataflow.Nullness

Imports

csharp

The default C# QL library.

Classes

AlwaysNullExpr

An expression that is always null.

Dereference

An expression that dereferences a value. That is, an expression that may result in a NullReferenceException if the value is null.

MaybeNullExpr

An expression that may be null.

NonNullExpr

An expression that is never null.

PathNode

An SSA definition, which may be null, augmented with at basic block which can be reached without passing through a null check.

Modules

PathGraph

Provides the query predicates needed to include a graph in a path-problem query for Dereference::is[First]MaybeNull().