Code review horror in 4 lines of code

added by DotNetKicks
12/31/2021 6:46:15 PM

339 Views

I run into the following code during code review and had an immediate and visceral reaction. This is a (bad) attempt to add thread safety, because you are getting a value through a read only interface, but there is still the mutable instance to work with at the source, and now you have someone that observes the instance while it is being mutated, outside the lock.


0 comments