-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
issues(4885) #4886
issues(4885) #4886
Conversation
@sfmskywalker can you please see and approve this PR ? |
@dotnet-policy-service agree |
@bbenameur the command you issued was incorrect. Please try again. Examples are:
and
|
@dotnet-policy-service agree |
this doesn't resolve the problem since TryRegisterSerializer throws an exception in addition to returning false if it couldn't register the serializer. private static void RegisterSerializers()
{
TryRegisterSerializerWithoutException(typeof(object), new PolymorphicSerializer());
TryRegisterSerializerWithoutException(typeof(Type), new TypeSerializer());
TryRegisterSerializerWithoutException(typeof(Variable), new VariableSerializer());
TryRegisterSerializerWithoutException(typeof(Version), new VersionSerializer());
TryRegisterSerializerWithoutException(typeof(JsonElement), new JsonElementSerializer());
}
private static void TryRegisterSerializerWithoutException(Type type, IBsonSerializer serializer)
{
try
{
BsonSerializer.TryRegisterSerializer(type, serializer);
}
catch (BsonSerializationException ex)
{
// should we log the exception ?
}
} |
BTW, you will face the same problem with private static void RegisterClassMaps()
{
BsonClassMap.TryRegisterClassMap<StoredBookmark>(cm =>
{
cm.AutoMap(); // Automatically map other properties
cm
.MapIdProperty(b => b.BookmarkId)
.SetSerializer(new StringSerializer(BsonType.String));
});
} |
Hello,
See issue:
#4885
Based on the context provided, it appears that we are encountering a serialization registration issue when running integration tests with Elsa and MongoDB. The error message indicates that a serializer for the Object type is being registered multiple times, which is not allowed by the MongoDB driver.
The code snippet provided suggests a solution to use BsonSerializer.TryRegisterSerializer instead of BsonSerializer.RegisterSerializer.