Repository navigation
perf: reduce allocations in ConfigureScope callbacks - #5856
Conversation
jamescrosswell
left a comment
There was a problem hiding this comment.
Thanks for picking this up @XAN9xXx! CI is failing on two tests in GlobalRootScopeIntegrationTests:
Register_GlobalModeEnabled_SetsInstallationIdOnRootScopeRegister_GlobalModeEnabled_DoesNotOverwriteExistingUserId
They check that the non-generic overload was called:
hub.Received(1).ConfigureScope(Arg.Any<Action<Scope>>());GlobalRootScopeIntegrationTests.cs#L51 and #L82
GlobalRootScopeIntegration now calls ConfigureScope<SentryOptions>, so those assertions need to match the generic overload:
hub.Received(1).ConfigureScope(Arg.Any<Action<Scope, SentryOptions>>(), Arg.Any<SentryOptions>());Please change the DidNotReceive() assertion at #L27 the same way. It still passes as written, but it's checking an overload that's no longer called, so it no longer tests anything.
To run just these tests locally:
dotnet test test/Sentry.Tests --filter GlobalRootScopeIntegrationTests
|
I've applied the suggestions and updated all three assertions. All |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5856 +/- ##
==========================================
- Coverage 76.69% 76.67% -0.02%
==========================================
Files 528 528
Lines 19527 19524 -3
Branches 3840 3840
==========================================
- Hits 14976 14971 -5
- Misses 3667 3668 +1
- Partials 884 885 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jamescrosswell
left a comment
There was a problem hiding this comment.
Nice - thanks @XAN9xXx ❤️
Description
Use the
ConfigureScope<TArg>overload with static callbacks to reduce allocations in ASP.NET, Blazor WebAssembly, gRPC, MAUI CommunityToolkit MVVM, and global root scope initialization.Issues
Closes #5219