CodeQL library for C#
codeql/csharp-all 5.3.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.

Predicates

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.