Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrent validation using RequiredIfAttribute throws NullReferenceException #214

Open
xhafan opened this issue Apr 4, 2023 · 1 comment

Comments

@xhafan
Copy link

xhafan commented Apr 4, 2023

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 added a commit to SmartGuideApp/UoN.ExpressiveAnnotations.NetCore that referenced this issue Apr 4, 2023
…NullReferenceException - fixing ExpressiveAttribute temporarily setting PropertyType to null on a shared attribute instance, causing other threads to throw NullReferenceException
xhafan added a commit to SmartGuideApp/ExpressiveAnnotations that referenced this issue Apr 4, 2023
…NullReferenceException - fixing ExpressiveAttribute temporarily setting PropertyType to null on a shared attribute instance, causing other threads to throw NullReferenceException
@xhafan
Copy link
Author

xhafan commented Apr 4, 2023

PR: #215

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant