Skip to content
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

Error updating to MongoDb latest driver version and Elsa 2.11 #4000

Open
alkampfergit opened this issue May 4, 2023 · 2 comments
Open

Error updating to MongoDb latest driver version and Elsa 2.11 #4000

alkampfergit opened this issue May 4, 2023 · 2 comments
Labels
bug Something isn't working elsa 2

Comments

@alkampfergit
Copy link

Upgrading to latest mongodb driver required by Elsa 2.11 we have problem due to the new LINQ3 provider of 2.19 version of MongoDB C# drivers that is causing serious regressions in the provider. See here to view one of the complaint

Due to this bug actually elsa persistence layer does not work anymore throwing exceptions.

System.InvalidCastException: Unable to cast object of type 'Elsa.Persistence.MongoDb.Serializers.ObjectSerializer' to type 'MongoDB.Bson.Serialization.Serializers.ObjectSerializer'.
   at MongoDB.Bson.Serialization.Serializers.DiscriminatedInterfaceSerializer`1..ctor(IDiscriminatorConvention discriminatorConvention, IBsonSerializer`1 interfaceSerializer)
   at MongoDB.Bson.Serialization.Serializers.DiscriminatedInterfaceSerializer`1..ctor(IDiscriminatorConvention discriminatorConvention)
   at MongoDB.Bson.Serialization.Serializers.DiscriminatedInterfaceSerializer`1..ctor()
   at InvokeStub_DiscriminatedInterfaceSerializer`1..ctor(Object, Object, IntPtr*)
   at System.Reflection.ConstructorInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.ConstructorInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
   at MongoDB.Bson.Serialization.BsonSerializationProviderBase.CreateSerializer(Type serializerType, IBsonSerializerRegistry serializerRegistry)
   at MongoDB.Bson.Serialization.BsonSerializationProviderBase.CreateGenericSerializer(Type serializerTypeDefinition, Type[] typeArguments, IBsonSerializerRegistry serializerRegistry)
   at MongoDB.Bson.Serialization.DiscriminatedInterfaceSerializationProvider.GetSerializer(Type type, IBsonSerializerRegistry serializerRegistry)
   at MongoDB.Bson.Serialization.BsonSerializerRegistry.CreateSerializer(Type type)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at MongoDB.Bson.Serialization.BsonSerializerRegistry.GetSerializer(Type type)

Actually to solve the problem we need to let the user to choose to default to old LINQ2 provider and migrate to LINQ3 provider once it will be stable.

alkampfergit added a commit to alkampfergit/elsa-core that referenced this issue May 4, 2023
Added an option to allow the user to opt-in for LINQ3 provider
that actually causes regressions. See elsa-workflows#4000
alkampfergit added a commit to alkampfergit/elsa-core that referenced this issue May 4, 2023
Added an option to allow the user to opt-in for LINQ3 provider
that actually causes regressions. See elsa-workflows#4000
@alkampfergit
Copy link
Author

Actually there is probably a bug in the new mongodb driver that does not allow registring own ObjectSerializer, because in the LINQ3 provider (LINQ2 is fine) there is an hard cast to MongoDb driver own implementation of ObjectSerializer, I've opened a bug in mongo C# library.

alkampfergit added a commit to alkampfergit/elsa-core that referenced this issue May 9, 2023
Added an option to allow the user to opt-in for LINQ3 provider
that actually causes regressions. See elsa-workflows#4000
@sfmskywalker
Copy link
Member

It looks like this is the same issue as #3975. I'll close the other one since you provided a PR associated with this issue.

sfmskywalker pushed a commit that referenced this issue May 11, 2023
Added an option to allow the user to opt-in for LINQ3 provider
that actually causes regressions. See #4000
@sfmskywalker sfmskywalker added bug Something isn't working elsa 2 labels May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working elsa 2
Projects
None yet
Development

No branches or pull requests

2 participants