Closed suadev closed 4 years ago
@suadev , thank you for contributing!
@suadev, I get the following error after running the application:
12:17:48:558 [Debug]: Execution of command 'ExampleCommand' with ID 'command-a478d189-d908-4bb9-918f-c7507b1eb9ee' on aggregate 'EventFlowExample.Aggregates.ExampleAggregate' failed due to exception 'TypeInitializationException' with message: The type initializer for 'MongoDB.Bson.Serialization.BsonClassMap' threw an exception. - System.TypeInitializationException: The type initializer for 'MongoDB.Bson.Serialization.BsonClassMap' threw an exception.
---> System.ArgumentNullException: Value cannot be null. (Parameter 'type')
at System.Reflection.IntrospectionExtensions.GetTypeInfo(Type type)
at MongoDB.Bson.Serialization.BsonClassMap..cctor()
--- End of inner exception stack trace ---
at MongoDB.Bson.Serialization.BsonClassMap.LookupClassMap(Type classType)
at MongoDB.Bson.Serialization.BsonClassMapSerializationProvider.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)
at MongoDB.Bson.Serialization.BsonSerializerRegistry.GetSerializer[T]()
at MongoDB.Driver.MongoCollectionImpl`1..ctor(IMongoDatabase database, CollectionNamespace collectionNamespace, MongoCollectionSettings settings, ICluster cluster, IOperationExecutor operationExecutor)
at MongoDB.Driver.MongoDatabaseImpl.GetCollection[TDocument](String name, MongoCollectionSettings settings)
at EventFlow.MongoDB.SnapshotStores.MongoDbSnapshotPersistence.GetSnapshotAsync(Type aggregateType, IIdentity identity, CancellationToken cancellationToken)
at EventFlow.Snapshots.SnapshotStore.LoadSnapshotAsync[TAggregate,TIdentity,TSnapshot](TIdentity identity, CancellationToken cancellationToken)
at EventFlow.Snapshots.SnapshotAggregateRoot`3.LoadAsync(IEventStore eventStore, ISnapshotStore snapshotStore, CancellationToken cancellationToken)
at EventFlow.Aggregates.AggregateStore.LoadAsync[TAggregate,TIdentity](TIdentity id, CancellationToken cancellationToken)
at EventFlow.Aggregates.AggregateStore.<>c__DisplayClass11_0`3.<<UpdateAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at EventFlow.Core.TransientFaultHandler`1.TryAsync[T](Func`2 action, Label label, CancellationToken cancellationToken)
at EventFlow.Aggregates.AggregateStore.UpdateAsync[TAggregate,TIdentity,TExecutionResult](TIdentity id, ISourceId sourceId, Func`3 updateAggregate, CancellationToken cancellationToken)
at EventFlow.CommandBus.ExecuteCommandAsync[TAggregate,TIdentity,TResult](ICommand`3 command, CancellationToken cancellationToken)
at EventFlow.CommandBus.PublishAsync[TAggregate,TIdentity,TResult](ICommand`3 command, CancellationToken cancellationToken)
I reverted your commit, you can create a new pull request.