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
In #675, we added overloads to Capture methods to take an Action<Scope> parameter. This was good, and should remain. This is the preferred method to capture using one-off scope-based configuration.
At the same time, we decided to obsolete SentrySdk.WithScope. IMHO, this wasn't necessary, and should be undone.
Justification:
WithScope is still useful when many things are going to be done within a single new scope, such as adding breadcrumbs, starting a transaction, performing work that may need to capture multiple events, etc.
ISentryScopeManager.WithScope wasn't obsoleted, so hub.WithScope still works. Generally, anything that works on an IHub instance should also be available statically on SentrtySdk.
Solution Brainstorm
Remove Obsolete attribute from SentrySdk.WithScope. Add some comments to suggest using Capture overloads in the original use case of only needing to configure scope for a single event.
Also, we should expand this to include WithScopeAsync. Overloads should also exist for returning values (ie: T WithScope<T> and Task<T> WithScopeAsync<T>).
The text was updated successfully, but these errors were encountered:
Problem Statement
In #675, we added overloads to
Capture
methods to take anAction<Scope>
parameter. This was good, and should remain. This is the preferred method to capture using one-off scope-based configuration.At the same time, we decided to obsolete
SentrySdk.WithScope
. IMHO, this wasn't necessary, and should be undone.Justification:
WithScope
is still useful when many things are going to be done within a single new scope, such as adding breadcrumbs, starting a transaction, performing work that may need to capture multiple events, etc.WithScope
would be easier thanPushScope
+ConfigureScope
for Improve guidance for .NET Worker Services #2274ISentryScopeManager.WithScope
wasn't obsoleted, sohub.WithScope
still works. Generally, anything that works on anIHub
instance should also be available statically onSentrtySdk
.Solution Brainstorm
Remove
Obsolete
attribute fromSentrySdk.WithScope
. Add some comments to suggest usingCapture
overloads in the original use case of only needing to configure scope for a single event.Also, we should expand this to include
WithScopeAsync
. Overloads should also exist for returning values (ie:T WithScope<T>
andTask<T> WithScopeAsync<T>
).The text was updated successfully, but these errors were encountered: