Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
### BREAKING CHANGES

- SentryOptions.IsEnvironmentUser now defaults to false on MAUI. The means the User.Name will no longer be set, by default, to the name of the device ([#4606](https://github.com/getsentry/sentry-dotnet/pull/4606))
- Remove unnecessary files from SentryCocoaFramework before packing ([#4602](https://github.com/getsentry/sentry-dotnet/pull/4602))
- Remove unnecessary files from SentryCocoaFramework before packing ([#4623](https://github.com/getsentry/sentry-dotnet/pull/4623))

### Fixes

- The SDK avoids redundant scope sync after transaction finish ([#4479](https://github.com/getsentry/sentry-dotnet/pull/4479))

## 6.0.0-preview.1

Expand Down
6 changes: 1 addition & 5 deletions src/Sentry/Scope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -818,11 +818,7 @@ internal void ResetTransaction(ITransactionTracer? expectedCurrentTransaction)
if (ReferenceEquals(_transaction.Value, expectedCurrentTransaction))
{
_transaction.Value = null;
if (Options.EnableScopeSync)
{
// We have to restore the trace on the native layers to be in sync with the current scope
Options.ScopeObserver?.SetTrace(PropagationContext.TraceId, PropagationContext.SpanId);
}
SetPropagationContext(new SentryPropagationContext());
}
}
finally
Expand Down
6 changes: 1 addition & 5 deletions src/Sentry/TransactionTracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,7 @@ public void Finish()

// Clear the transaction from the scope and regenerate the Propagation Context
// We do this so new events don't have a trace context that is "older" than the transaction that just finished
_hub.ConfigureScope(static (scope, transactionTracer) =>
{
scope.ResetTransaction(transactionTracer);
scope.SetPropagationContext(new SentryPropagationContext());
}, this);
_hub.ConfigureScope(static (scope, transactionTracer) => scope.ResetTransaction(transactionTracer), this);

// Client decides whether to discard this transaction based on sampling
_hub.CaptureTransaction(new SentryTransaction(this));
Expand Down
6 changes: 2 additions & 4 deletions test/Sentry.Tests/ScopeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,6 @@ public void ResetTransaction_MatchingTransaction_ObserverSetsTraceFromPropagatio
});
var transaction = new TransactionTracer(DisabledHub.Instance, "test-transaction", "op");
scope.Transaction = transaction;

var expectedTraceId = scope.PropagationContext.TraceId;
var expectedSpanId = scope.PropagationContext.SpanId;
var expectedCount = enableScopeSync ? 1 : 0;

observer.ClearReceivedCalls();
Expand All @@ -367,7 +364,8 @@ public void ResetTransaction_MatchingTransaction_ObserverSetsTraceFromPropagatio
scope.ResetTransaction(transaction);

// Assert
observer.Received(expectedCount).SetTrace(Arg.Is(expectedTraceId), Arg.Is(expectedSpanId));
observer.Received(expectedCount)
.SetTrace(Arg.Is(scope.PropagationContext.TraceId), Arg.Is(scope.PropagationContext.SpanId));
}

[Theory]
Expand Down
Loading