You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Decide whether auto instrumented transactions in MAUI should set Scope.Transaction #5313
We do that for ASP.NET Core already ... but .NET MAUI uses (or should at least use) a Global Scope (user code could, but should not, overwrite the default we set in our MAUI init)
Thoughts
clicking/tapping a button that does perform a navigation
clicking/tapping a button that does not navigate
Edge Case
.NET MAUI app on Windows, where SQL Server is used, and DiagnosticSource integration is used, which only instruments when Scope.Transaction is not null. So performance spans on MAUI would not capture DB calls.
We do want to auto-set the transaction onto the current scope, but only when there is no Transaction assigned to the scope already (scope.Transaction ??= transaction).
Considered this scenario:
our auto-instrumentation via a Button click starts a Transaction
and now also sets it
the user's event handler StartTransaction starting a new Root-Transaction (unlike StartSpan that would start a Child-Span)
Activity
linear-code commentedon Jun 25, 2026
NET-713
Flash0ver commentedon Jul 1, 2026
We do that for ASP.NET Core already ... but .NET MAUI uses (or should at least use) a Global Scope (user code could, but should not, overwrite the default we set in our MAUI init)
Thoughts
Edge Case
.NET MAUI app on Windows, where SQL Server is used, and DiagnosticSource integration is used, which only instruments when
Scope.Transaction is not null. So performance spans on MAUI would not capture DB calls.We could also make this behavior an opt-in.
This issue becomes relevant with #5138.
Also considering https://develop.sentry.dev/sdk/foundations/state-management/scopes/
SentrySdk.PushScopeonto the Stack when not in Global ModeFlash0ver commentedon Jul 8, 2026
We do want to auto-set the transaction onto the current scope, but only when there is no Transaction assigned to the scope already (
scope.Transaction ??= transaction).Considered this scenario:
StartTransactionstarting a new Root-Transaction (unlikeStartSpanthat would start a Child-Span)Scope.Transactionwould still have our auto-instrumented UI-Span, rather than the user's TransactionConfigureScope(scope => scope.Transaction = transaction);jamescrosswell commentedon Jul 9, 2026
Implemented in:
sentry-dotnet/src/Sentry.Maui/Internal/MauiEventsBinder.cs
Lines 434 to 435 in f5d5bb4