Skip to content

Locks On Objects With Weak Identities

Michael Damatov edited this page Jan 17, 2024 · 3 revisions

The following object types should never be used as lock monitors:

  • string
  • arrays of value types
  • MarshalByRefObject derivatives
  • ExecutionEngineException
  • OutOfMemoryException or derivatives
  • StackOverflowException
  • MemberInfo derivatives
  • ParameterInfo or derivatives
  • Thread
  • this

💡 The analyzer can be deactivated in the ReSharper Options dialog.

References