Skip to content

MongoDB is unavailable. #1372

@ppsurcao

Description

@ppsurcao

Modify services.AddWorkflow(x => x.UseMongoDB(@"mongodb://localhost:27017", "workflow"));, then directly start the WorkflowCore.Sample04 project.

An error is immediately thrown in the Deserialize method of the DataObjectSerializer file:

MongoDB.Bson.BsonSerializationException: "Type WorkflowCore.Sample04.MyDataClass is not configured as a type that is allowed to be deserialized for this instance of ObjectSerializer."

I tried adding the following code before the program starts:

csharp
var objectSerializer = new ObjectSerializer(type => ObjectSerializer.DefaultAllowedTypes(type) || type.FullName.StartsWith("WorkflowCore"));
BsonSerializer.RegisterSerializer(objectSerializer);

The error disappeared, but based on the database data, the following code:

csharp
.WaitFor("MyEvent", (data, context) => context.Workflow.Id, data => DateTime.Now).Output(data => data.Value1, step => step.EventData)

did not assign values correctly, which caused the workflow to fail to proceed.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions