Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CaptureFeedback overload accepting a scope parameter #4035

Open
jamescrosswell opened this issue Mar 13, 2025 · 0 comments · May be fixed by #4073
Open

Add CaptureFeedback overload accepting a scope parameter #4035

jamescrosswell opened this issue Mar 13, 2025 · 0 comments · May be fixed by #4073
Assignees
Labels
Good First Issue Good for newcomers

Comments

@jamescrosswell
Copy link
Collaborator

          > 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for newcomers
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant