We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e07c637 commit ef106afCopy full SHA for ef106af
src/MongoDB.Bson/Serialization/BsonClassMap.cs
@@ -295,7 +295,15 @@ public static Type GetMemberInfoType(MemberInfo memberInfo)
295
/// <returns>All registered class maps.</returns>
296
public static IEnumerable<BsonClassMap> GetRegisteredClassMaps()
297
{
298
- return __classMaps.Values;
+ BsonSerializer.ConfigLock.EnterReadLock();
299
+ try
300
+ {
301
+ return __classMaps.Values.ToList(); // return a copy for thread safety
302
+ }
303
+ finally
304
305
+ BsonSerializer.ConfigLock.ExitReadLock();
306
307
}
308
309
/// <summary>
0 commit comments