Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #3597: InvalidCastException in FetchForWriting #3599

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

Strythio
Copy link
Contributor

@Strythio Strythio commented Dec 15, 2024

Fixes #3597: InvalidCastException in FetchForWriting

This PR resolves #3597, where the FetchForWriting<T> (the overload accepting an expected version) would throw an InvalidCastException under the following conditions:

  • The aggregate is Inline.
  • UseIdentityMapForAggregates = true.

Changes Made

  • Fixed the bug in FetchInlinedPlan.cs.
  • Added tests specifically for the bug.

Testing

  • Initial tests run successfully.
  • Added tests for the bug.
  • Verified that all tests (new and existing) pass.

Notes

  • I only wrote tests for the Guid identifier case. Many of the existing tests target both Guid and string identifier aggregates. While my tests should cover the scenario effectively, I am happy to add tests for the string variants if needed. Let me know if this is required.
  • I should note that many of the tests in the StressTests project failed, but they fail for me with or without my changes.

Feedback

This is my first pull request, and I am eager to learn! If any changes are needed, I will address them promptly. Any additional feedback on the implementation or testing strategy is also welcome.

…ver a bug where an InvalidCastException is thrown when the aggregate is inline and UseIdentityMapForAggregates = true.
…ersion) would throw an InvalidCastException when the aggregate is inline and UseIdentityMapForAggregates = true.
@jeremydmiller
Copy link
Member

@Strythio Thank you very much for doing this! The CI failures aren't related to your work (we have constant problems w/ blinking tests". This will be in 7.34.1 immediately

@jeremydmiller jeremydmiller merged commit 7154e3f into JasperFx:master Dec 16, 2024
3 of 5 checks passed
@Strythio
Copy link
Contributor Author

Awesome! Glad I could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FetchForWriting throws exception when passing expected version with UseIdentityMapForAggregates = true.
2 participants