Skip to content

Conversation

jamescrosswell
Copy link
Collaborator

Resolves #4608

For discussion

There are a couple of APIs left that are still marked as obsolete, which probably merit some discussion:

Extra

SentrySpan, SentryTransaction and TransactionTracer all have Extra members like:

/// <inheritdoc />
[Obsolete("Use Data")]
public IReadOnlyDictionary<string, object?> Extra => Data;

/// <inheritdoc />
[Obsolete("Use SetData")]
public void SetExtra(string key, object? value) => SetData(key, value);

Although we do probably want to get rid of these, as believe we also want to get rid of the Data members that we're recommending people switch to... since I think all of these will be replaced by Attributes at some stage right?

Possibly we delay replacing these until the new Attributes are available and, at that point, we could ship an Analyzer and a Code fix to help people migrate (since Extras may be used quite widely).

GetInternalSentryOptions

We also have this, which is a bit of a misuse of the ObsoleteAttribute:

/// <summary>
/// <para>
/// Gets internal SentryOptions for integrations like Hangfire that don't support strong assembly names.
/// </para>
///<remarks>
/// *** This is not meant for external use !!! ***
/// </remarks>>
/// </summary>
/// <param name="clientOrHub"></param>
/// <returns></returns>
[Obsolete("WARNING: This method is meant for internal usage only")]
public static SentryOptions? GetInternalSentryOptions(this ISentryClient clientOrHub) =>
clientOrHub.GetSentryOptions();

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.

CrashType

Same again for the APIs designed to deliberately create a crash:

[Obsolete("WARNING: This method deliberately causes a crash, and should not be used in a real application.")]
public enum CrashType

EnableWatchdogTerminationTracking

Not sure what we want to do with this. Is the long term plan to remove this functionality entirely or are we planning to address the issues with this and "unobsolete" it eventually?

/// <summary>
/// Whether to enable watchdog termination tracking or not. NOT advised.
/// The default value is <c>false</c> (disabled).
/// </summary>
/// <remarks>
/// This feature is prone to false positives on .NET since it relies on heuristics that don't work in this environment.
/// </remarks>
/// <seealso href="https://github.com/getsentry/sentry-dotnet/issues/3860" />
/// <seealso href="https://docs.sentry.io/platforms/apple/configuration/watchdog-terminations/" />
[Obsolete("See: https://github.com/getsentry/sentry-dotnet/issues/3860")]
public bool EnableWatchdogTerminationTracking { get; set; } = false;

In the meantime, do we want to remove it from the .NET API?

Copy link

codecov bot commented Oct 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (version6@33615f4). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             version6    #4619   +/-   ##
===========================================
  Coverage            ?   73.04%           
===========================================
  Files               ?      478           
  Lines               ?    17315           
  Branches            ?     3422           
===========================================
  Hits                ?    12647           
  Misses              ?     3813           
  Partials            ?      855           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jamescrosswell jamescrosswell marked this pull request as ready for review October 10, 2025 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant