Problem Statement
I use the following code to configure a scope, capturing a value to be set as a tag on the scope. Unfortunately, this always results in a delegate allocation because of the capture.
string tagValue = "value";
SentrySdk.ConfigureScope(scope => scope.SetTag("tag_name", tagValue));
Solution Brainstorm
Perhaps there already is a better way to set a tag on the current scope, but otherwise I'd propose adding the following methods:
public static partial class SentrySdk
{
+ public static void ConfigureScope<TArg>(Action<Scope, TArg> configureScope, TArg arg);
+ public static Task ConfigureScopeAsync<TArg>(Func<Scope, TArg, Task> configureScope, TArg arg);
}
These methods could then be used like this:
string tagValue = "value";
SentrySdk.ConfigureScope(
static (scope, arg) => scope.SetTag("tag_name", arg),
tagValue);
I'd be happy to provide the implementation if this is something you're interested in.
Problem Statement
I use the following code to configure a scope, capturing a value to be set as a tag on the scope. Unfortunately, this always results in a delegate allocation because of the capture.
Solution Brainstorm
Perhaps there already is a better way to set a tag on the current scope, but otherwise I'd propose adding the following methods:
public static partial class SentrySdk { + public static void ConfigureScope<TArg>(Action<Scope, TArg> configureScope, TArg arg); + public static Task ConfigureScopeAsync<TArg>(Func<Scope, TArg, Task> configureScope, TArg arg); }These methods could then be used like this:
I'd be happy to provide the implementation if this is something you're interested in.