Skip to content

Add CaptureFeedback overload accepting a scope parameter #4035

@jamescrosswell

Description

@jamescrosswell
          > Can there be an `Action<Scope> configureScope` parameter on `CaptureFeedback`? [The documentation](https://docs.sentry.io/platforms/dotnet/enriching-events/scopes/#using-scope-callback-parameter) even says:

That particular example shows the CaptureException method... but yes, those docs do say the scope can be passed on all capture methods - so we should probably add this.

It's really just a convenience. As a workaround, in the meantime, the same can be achieved by:

        using (var scopeTracker = SentrySdk.PushScope())
        {
            SentrySdk.ConfigureScope(s =>
            {
                s.SetTag("my-tag", "my value");
                s.User = new SentryUser
                {
                    Id = "42",
                    Email = "[email protected]"
                };
            });
            var feedback = new SentryFeedback(message, contactEmail, name);
            SentrySdk.CaptureFeedback(feedback, hint: hint);
        }

Note that the temporary local scope gets popped when scopeTracker gets disposed above... so important to dispose of it before creating other events that you don't want that scope applied to.

Originally posted by @jamescrosswell in #3981 (comment)

Metadata

Metadata

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions