JetBrains Rider
 
2024.3
Get JetBrains Rider

Code inspection: Inconsistent synchronization on field

Last modified: 11 February 2024

This code inspection warns you about fields being used both with and without locking, thus helping you detect potential problems with thread safety. Here is an example:

The inspection is not triggered on const fields and in private methods that have no synchronization inside but are always used from synchronized contexts.