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

Endpoints containing sagas fail to start when a scanned assembly contains a ref struct #7196

Merged
merged 6 commits into from
Oct 29, 2024

Conversation

andreasohlund
Copy link
Member

Backport of #7187 which fixes #7179 for the release-9.1 branch

* Prevent saga conventions from throwing on ref struct

* Better test

* Tweaks

---------

Co-authored-by: Mike Minutillo <mike.minutillo@particular.net>
@andreasohlund andreasohlund self-assigned this Oct 28, 2024
@andreasohlund andreasohlund added this to the 7.8.6 milestone Oct 28, 2024
src/NServiceBus.Core/Sagas/Sagas.cs Outdated Show resolved Hide resolved
Co-authored-by: Daniel Marbach <daniel.marbach@openplace.net>
@andreasohlund
Copy link
Member Author

@poornimanayar @danielmarbach did some benchmarking and the strin.equals version of .CustomAttributes seems to be most performant but its very close

Method Mean Error StdDev
CustomAttributes 340.7 ns 2.55 ns 2.38 ns
CustomAttributesStringEquals 321.4 ns 1.89 ns 1.58 ns
GetCustomAttributesData 357.5 ns 1.42 ns 1.18 ns

@andreasohlund
Copy link
Member Author

The test was iterating all scanned types of an endpoint running the learning transport and persister

@andreasohlund
Copy link
Member Author

Since I ran the tests on .net8 I'll switch to equals since its likely that the performance gains are even larger on .net451

@andreasohlund andreasohlund merged commit 4eb5c13 into release-7.8 Oct 29, 2024
3 checks passed
@andreasohlund andreasohlund deleted the backport-refstruct-78 branch October 29, 2024 16:57
@poornimanayar poornimanayar changed the title Ref struct in scanned assembly results in app crash at startup, if sagas are present Endpoints containing sagas fail to start when a scanned assembly contains a ref struct Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants