Give a private field with public read access by the property and a method where this field is written. I use the lock to make a consistent write in a method, but I have no lock in the property. Code inspection warn me with "Inconsistent synchronization on field" hint, but I don't realize what can go wrong? Can anybody explain, is it a correct hint in this situation?
class Foo { private object field; public object Field { get =\> this.field } public void SomeMethod(){ lock(syncRoot) { if () this.field = newValue; } } }