Bug: Elsa 2.0 MongoDb Deserializing
See original GitHub issueWhen loading workflow instances I get the following error.
An error occurred while deserializing the Activities property of class Elsa.Models.WorkflowInstance: An error occurred while deserializing the Output property of class Elsa.Models.ActivityInstance: Unknown discriminator value 'FinishOutput'.
I already know the cause of this: https://stackoverflow.com/a/43312423
BsonClassMap.RegisterClassMap<FinishOutput>(); will fix the problem.
But it will probably happen more often. It would be best to register the classes centrally, so that in Elsa.Persistence.MongoDb only the central place has to be read and thus no dependencies to other projects exist.
I just don’t know yet where it is nicest and how to name it best.
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (10 by maintainers)
Top Results From Across the Web
Problem with deserialization - Drivers & ODMs
I have a class with a Point class field called “APoint”. The document is created and APoint is an object with X and...
Read more >4.4 Changelog
SERVER-68115 Bug fix for "elemMatchRootLength > 0" invariant trigger ... SERVER-40865 The ShardServerCatalogCacheLoader does not serialize read operations ...
Read more >MongoDB .NET Driver not deserializing for collection
Mongo.GardaSubdistrictBoundaryMongo: An error occurred while deserializing the Coordinates property of class VisualStatsPoCAPI.Repositories.
Read more >Release notes — JaVers Documentation
1092 Fixed bug when deserializing Diff from JSON: MALFORMED_CHANGE_TYPE_FIELD : no such Change type - InitialChange . 6.1.0. released on 2021-04-25. 1080 New ......
Read more >[Solved]-Deserialize object as an interface with MongoDB C# ...
In resume, this exception error is related to structs deserialization, not with interfaces deserialization. Anyway, it is a real problem, and the second...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@Juandavi1 This should be fixed with the latest preview packages available on MyGet and of course in
master. Please feel free to reopen if you can still reproduce this issue with the latest version and repro steps. Thanks!Tricky problem, here’s why:
BsonClassMap.RegisterClassMap<T>.One not-so-great solution I can think of is to require the host application to register these types, like so:
Which is far from ideal of course, because now the user needs to understand what types to register, depending on what activity packages they use.
So what we might do instead is let Newtonsoft.Json take care of object serialization, which does not require “known types” to be registered.
I tried it and it works wonders, but it also means that it will break existing MongoDB databases where they basically need to wipe their DB.