jacqueskang / EventSourcing

.NET Core event sourcing framework
MIT License
178 stars 29 forks source link

Update TextFileSnapshotStore.cs #79

Open warrantor opened 2 years ago

warrantor commented 2 years ago

Fix bug so only relevant files are loaded from the filesystem to determine if snapshot should be loaded.

Context

While loading an aggregate with ignoreSnapshot: false in the method FindAggregateAsync(id, ignoreSnapshot, version), the TextFileSnapshotStore loads all files from the file system and checks if there is a file with a version larger than the version of the aggregate. If an other aggregate has a snapshot and the version is lower or equals the current version of the aggregate, the snapshot is considered as the snapshot for this aggregate. The result of this faulty filtering, is that the program tries to load a non-existing file from the file system, and crashes.

This fix checks if the files in the snapshot store contains a snapshot for the correct aggregate.

80

warrantor commented 1 year ago

Hello, I see that the pipeline wasn't successful and that this PR was never merged. This bug still exists in the current release.