sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Consider alternative to ObsoleteAttribute on GetInternalSentryOptions

Open jamescrosswell opened this issue 2 months ago • 1 comments

Description

This is a bit of a misuse of the ObsoleteAttribute: https://github.com/getsentry/sentry-dotnet/blob/216bbc597a167f9d26216f968b9fc21cbff99a54/src/Sentry/SentryClientExtensions.cs#L98-L110

We could potentially replace it with this:

[InternalApi("For internal integrations like Hangfire only")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static SentryOptions? GetInternalSentryOptions(this ISentryClient clientOrHub) =>
    clientOrHub.GetSentryOptions();

And then also ship a Roslyn Analyzer that warns if people use something decorated with InternalApiAttribute.

See also

  • https://github.com/getsentry/sentry-dotnet/pull/4619#discussion_r2432364301

jamescrosswell avatar Oct 15 '25 22:10 jamescrosswell

NET-497

linear[bot] avatar Oct 15 '25 22:10 linear[bot]