Skip to content

Consider alternative to ObsoleteAttribute on GetInternalSentryOptions #4641

@jamescrosswell

Description

@jamescrosswell

Description

This 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.

See also

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions