getsentry / getsentry/sentry-dotnet

Consider alternative to ObsoleteAttribute on GetInternalSentryOptions

Open
#4,641 1 comment 0 reactions 0 assignees View on GitHub
.NET Next Major Repository Maintenance Task
Dominant language
C#
Stars
770
Forks
248
Avg merge
3d 4h
Merged PRs (30d)
49

Description

### 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:
```csharp
[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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.