I've added the code in the answer to this question: Unknown discriminator value 'MyEvent', but it didn't help.
An error occurred while deserializing the Body property of class EventStore.EventMessage: Unknown discriminator value : "Insert event name".Error only occurs when you try to rehydrate a saved object after program restart.
Running latest MyGet Build
Sample Repository:https://github.com/tonyeung/EventStore-MongoDB
To replicate the issue:
run the program
press c to create a new record
press q to quit
run the program again
but press r to rehydrate
error triggers
If you run the program, press c, press enter to continue, and press r to rehydrate without quitting, the object is rehydrated without a problem. WAT?
using (var eventStore = WireupEventStore()) { var snapshot = eventStore.Advanced.GetSnapshot(ID, int.MaxValue); if (snapshot == null) { // ERRORS HERE using (var stream = eventStore.OpenStream(ID, 0, int.MaxValue)) { var events = from s in stream.CommittedEvents select s.Body as IEvent; obj.LoadsFromHistory(events); } } }
github issue: https://github.com/NEventStore/NEventStore/issues/203