Description
The lock keyword on object/non-Lock types should be replaced with the Lock class from System.Threading.Bad Code
Good Code
Properties
- Category: Threading
- Severity: Warning
- Enabled by default: True
- Code fix available: True
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
The lock keyword on object/non-Lock types should be replaced with the Lock class
private object _syncRoot = new();
lock (_syncRoot) { }
private Lock _syncRoot = new();
lock (_syncRoot) { }
dotnet_diagnostic.AL0011.severity = warning
Was this page helpful?
