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

NullReferenceException at AggregateBuilder() call for aggregates with private constructors #2825

Closed
a-shtifanov-laya opened this issue Nov 28, 2023 · 0 comments · Fixed by #2834

Comments

@a-shtifanov-laya
Copy link
Contributor

a-shtifanov-laya commented Nov 28, 2023

Dear Community,

we found a strange behavior when AggregateBuilder() is null for single stream aggregates that do not have neither public constructor nor Create() method and when stream is aggregated in multiple parallel calls:

image

the aggregate:
image


I forked your example repository and made some changes in Helpdesk sample.
a-shtifanov-laya/marten-concurrency-bug@39b8ca0

In order to reproduce this behavior:

  • clone my forked repo https://github.com/a-shtifanov-laya/marten-concurrency-bug
  • open it in IDE and navigate to Sample\Helpdesk\Helpdesk.Api project
  • run from that directory
    • docker compose up -d postgres
    • dotnet run -- codegen write
  • place a breakpoint in program.cs in a catch block (i.e. line 164)
    image
  • debug AggregateStreamInParallelOf test
    image

you should land with exception in SingleStreamProjectionLiveAggregationXXXXXX like on my very first screenshot.

i'm wondering if it is a valid use case or we're doing something completely stupid that we get such an error (i.e. i had to disable optimistic check in order to reproduce it)


I'm actually ready to contribute if you decide that this should be corrected and point me a bit into the places that i should look at..

Thanks!

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 a pull request may close this issue.

1 participant