Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 466 Bytes

PH_B010.md

File metadata and controls

16 lines (10 loc) · 466 Bytes

PH_B010 - Incomplete Monitor Synchronization on Single Field

Problem

A single field is accessed multiple times inside a monitor lock. However, this field is also accessed outside of a monitor lock. Since there is at least one write-access, it incorporates the risk of a race condition.

Solution

Enclose the block with a monitor lock.

Options

# Report volatile fields: ignore (default) / report
dotnet_diagnostic.PH_B010.volatile = ignore