You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/MongoDB.Bson/Serialization/BsonSerializerRegistry.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -191,7 +191,7 @@ private void EnsureRegisteringASerializerForThisTypeIsAllowed(IBsonSerializer se
191
191
varmessage=string.Format("Generic type {0} has unassigned type parameters.",BsonUtils.GetFriendlyTypeName(type));
192
192
thrownewArgumentException(message,"type");
193
193
}
194
-
if(type!=serializer.ValueType)
194
+
if(!serializer.ValueType.IsAssignableFrom(type))
195
195
{
196
196
thrownewBsonSerializationException($"A serializer for {BsonUtils.GetFriendlyTypeName(serializer.ValueType)} cannot be registered for type {BsonUtils.GetFriendlyTypeName(type)}.");
0 commit comments