workflow-core icon indicating copy to clipboard operation
workflow-core copied to clipboard

BsonDeserialization fails

Open mapkuh0000 opened this issue 5 years ago • 5 comments

STR:

  1. Configure JsonSerialization to use camelCase in your project
  2. Instal WorkflowCore as Nuget package.
  3. Create a workflow that passes the data between steps.
  4. Configure the workflow to use MongoDB.
  5. Start the workflow.

Expected result:

  1. The workflow created.
  2. Each step proceeds correctly.

Actual result:

  1. The workflow created.
  2. No step can be processed because the state (Workflow.Data) can not be read from the MongoDB.

Solution: We need to read BSON documents in the same way we write them. code changes

mapkuh0000 avatar Feb 26 '20 06:02 mapkuh0000

Could you include a project that replicates this issue? The workflow data serialization for MongoDB does work in the examples.

danielgerlag avatar Mar 05 '20 02:03 danielgerlag

Hi Daniel, I have the same issue)

jzevakin avatar Apr 28 '20 15:04 jzevakin

Hi Daniel, It works for me if I do next changes in MongoPersistenceProvider.cs. 0001-Thta-is-fix-for.patch.zip

I agree with mapkuh0000. We need to read BSON documents in the same way we write them

I have workflow like this:

public class ConsumerWorkflow : IWorkflow<ConsumerContext>

Additionally I have marked ConsumerContext with Mongo attribute.

[BsonDiscriminator("ConsumerContext")] public class ConsumerContext

and

BsonClassMap.RegisterClassMap<ConsumerContext>();

Thank you. Hope it helps

jzevakin avatar Apr 28 '20 16:04 jzevakin

Encountered the same issue, is the patch posted by @jzevakin safe to use for now? Or it might have unwanted side effects?

vardior avatar Jun 07 '20 06:06 vardior

I am also facing the same issue on this context.

ajeyaprakash148 avatar Sep 17 '21 15:09 ajeyaprakash148