Skip to content

Commit

Permalink
CSHARP-5349: Added missing read lock.
Browse files Browse the repository at this point in the history
  • Loading branch information
rstam committed Nov 19, 2024
1 parent 6f5bfef commit 6d8d72b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/MongoDB.Bson/Serialization/BsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,17 @@ internal static IDiscriminatorConvention GetOrRegisterDiscriminatorConvention(Ty
}

internal static bool IsDiscriminatorConventionRegisteredAtThisLevel(Type type)
=> __discriminatorConventions.ContainsKey(type);
{
__configLock.EnterReadLock();
try
{
return __discriminatorConventions.ContainsKey(type);
}
finally
{
__configLock.ExitReadLock();
}
}

/// <summary>
/// Returns whether the given type has any discriminators registered for any of its subclasses.
Expand Down

0 comments on commit 6d8d72b

Please sign in to comment.