Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 584 Bytes

PH_B009.md

File metadata and controls

16 lines (10 loc) · 584 Bytes

PH_B009 - Incomplete Monitor Synchronization on Multiple Fields

Problem

Two or more fields are accessed inside a monitor lock. These fields are potentially related and represent a shared state. However, at least a subset consisting of at least two fields are accessed in a location that is missing the 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 readonly fields: ignore (default) / report
dotnet_diagnostic.PH_B009.readonly = ignore