Query module DeadStoreOfLocal

name
Useless assignment to local variable
description
An assignment to a local variable that is not used later on, or whose value is always overwritten, has no effect.
kind
problem
problem.severity
warning
id
cs/useless-assignment-to-local
tags
maintainability external/cwe/cwe-563
precision
very-high

Imports

csharp

The default C# QL library.

Predicates

getACapturingCallableAncestor

Gets a callable that either directly captures local variable v, or which is enclosed by the callable that declares v and encloses a callable that captures v.

getADelegateExpr
mayEscape

Holds if v is a captured local variable, and one of the callables capturing v may escape the local scope.

nonEscapingCall

Holds if c is a call where any delegate argument is evaluated immediately.

Classes