jwaliszko / ExpressiveAnnotations

Annotation-based conditional validation library.
MIT License
351 stars 123 forks source link

Concurrent validation using RequiredIfAttribute throws NullReferenceException #214

Open xhafan opened 1 year ago

xhafan commented 1 year ago

When concurrently validating an instance of a class which uses RequiredIfAttribute, multiple threads share the same instance of RequiredIfAttribute (likely by design), and it breaks in ExpressiveAttribute.AdjustMemberName as it's setting PropertyType to null on the RequiredIfAttribute instance which is used by other threads, which might throw NullReferenceException when the PropertyType is null.

xhafan commented 1 year ago

PR: https://github.com/jwaliszko/ExpressiveAnnotations/pull/215