Learn about the traps to avoid in multithreading with Roslyn analyzers. Avoid locking on publicly accessible members or this reference. Do not lock on objects with weak identity, non-readonly fields, or value types. Follow the best practice of creating a private and readonly instance of an object for locking.
Table of contents
DO NOT lock on publicly accessible members 🔗︎DO NOT lock on this reference 🔗︎DO NOT lock on objects with weak identity 🔗︎DO NOT lock on non-readonly fields 🔗︎DO NOT lock on value types 🔗︎Best practice for locking 🔗︎Summary 🔗︎Sort: