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

Predicate SourceVariableImpl::refReadBeforeWrite

Holds if a pseudo read for ref variable v happens at index i in basic block bb, just prior to an update of the referenced value. A pseudo read is inserted to make assignments to the ref variable live, for example line 2 in

void M() {
  ref int i = ref GetRef();
  i = 0;

The pseudo read is inserted at the CFG node i on the left-hand side of the assignment on line 3.

Import path

import semmle.code.csharp.dataflow.internal.SsaImpl
predicate refReadBeforeWrite(BasicBlock bb, int i, LocalScopeSourceVariable v)