Skip to content

Commit

Permalink
jwaliszko#214 Concurrent validation using RequiredIfAttribute throws …
Browse files Browse the repository at this point in the history
…NullReferenceException - fixing ExpressiveAttribute temporarily setting PropertyType to null on a shared attribute instance, causing other threads to throw NullReferenceException
  • Loading branch information
xhafan committed Apr 4, 2023
1 parent 33b2ffe commit ddb18d7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ protected override ValidationResult IsValid(object value, ValidationContext vali

private void AdjustMemberName(ValidationContext validationContext) // fixes for: MVC <= 4 (MemberName is not provided), WebAPI 2 (MemberName states for display name)
{
PropertyType = null; // reset value
if (PropertyType != null) return;

if (validationContext.MemberName == null && validationContext.DisplayName == null)
return;

Expand Down

0 comments on commit ddb18d7

Please sign in to comment.