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

Module ConsistencyChecks

Provides checks for the consistency of the data model and database.

Import path

import semmle.code.cil.ConsistencyChecks

Classes

AccessMissingTarget

An access that does not have exactly one target.

ArrayTypeInvalidRank

An array with an invalid getRank.

ArrayTypeMissingElement

An array with an invalid getElementType.

BranchWithoutTarget

A branch without a target.

CatchHandlerMissingType

A catch handler that doesn’t have a caught exception type.

CfgViolation

A consistency violation on a control flow node.

ConsistencyViolation

A consistency violation in the database or data model.

ConstructedMethodTypeParams

A constructed method that does not match its unbound method.

ConstructedSourceDeclarationMethod
DeadInstruction

A dead instruction, not reachable from any entry point. These should not exist, however it turns out that the Mono compiler sometimes emits them.

DeadInstructionViolation

An instruction that is not reachable from any entry point.

DeclarationViolation

A violation in a Member.

DeclarationWithMultipleLabels

A declaration with multiple labels.

DeclarationWithoutLabel

A declaration without a label.

DisabledCheck

A check that is deliberately disabled.

ExprMissingType

An expression that does not have exactly one type. Note that calls with no return have type System.Void.

ExprPushCount

An expression that have an unexpected push count.

FalseSuccessorIsSuccessor

An instruction whose false successor is not a successor.

InconsistentKind

The type of a kind must be consistent between a constructed generic and its unbound generic.

InconsistentMethodLocation

The location of a constructed method should be equal to the location of its unbound generic.

InconsistentPopCount

A CFG node that does not have exactly 1 getPopCount().

InconsistentPushCount

A CFG node that does not have exactly one getPushCount().

InconsistentTypeLocation

The location of a constructed generic type should be the same as the location of its unbound generic type.

InstructionViolation

A consistency violation in a specific instruction.

InvalidBranchSuccessors

A branch instruction that does not have exactly 2 successors.

InvalidExpressionViolation

An instruction that has a push count of 0, yet is still used as an operand

InvalidOverride

An override that is invalid because the overridden method is not in a base class.

InvalidPointerType

A pointer type that does not have a pointee type.

InvalidReturn

A return instruction that does not have a stack size of 0 after it.

InvalidStackSize

A CFG node that does not have exactly one stack size. Disabled because inconsistent stack sizes have been observed.

InvalidThrow

A throw instruction that does not have a stack size of 0 after it.

KindViolation

A type should have at most one kind, except for missing referenced types where the interface/class is unknown.

MemberWithInvalidName

A member with an invalid name.

MethodViolation

A consistency violation in a method.

MissingCallTarget

A call that does not have exactly one getTarget().

MissingCilDeclaration

A C# declaration which is expected to have a corresponding CIL declaration, but for some reason does not.

MissingEntityViolation

A violation marking an entity that should be present but is not.

MissingObjectViolation

The type object is missing from the database.

MissingOpCode

An instruction that has not been assigned a specific QL class.

MissingOperand

An instruction that is missing an operand. It means that there is no instruction which pushes a value onto the stack for this instruction to pop.

MissingStackSize

A CFG node that does not have a stack size.

MissingValue

A literal that does not have exactly one getValue().

NoFalseSuccessor

A branch instruction that does not have a false successor.

NoTrueSuccessor

A branch instruction that does not have a true successor.

OnlyYesNoBranchHasTrueFalseSuccessors

An instruction that has a true/false successor but is not a branch.

PropertyWithNoAccessors

Properties that have no accessors.

StaticFieldTarget

A field access where the field is “static” but the instruction is “instance”.

TrueSuccessorIsSuccessor

An instruction whose true successor is not a successor.

TypeIsBothConstructedAndUnbound

A type that has both type arguments and type parameters.

TypeMultiplyDefined

A type that has multiple entities with the same qualified name in System. .NET Core does sometimes duplicate types, so this check is disabled.

TypeParameterMismatch

A constructed type that does not match its unbound generic type.

TypeViolation

A consistency violation in a type.

UnconditionalBranchSuccessors

An unconditional branch instruction that has more than one successor.

YesNoBranch