Skip to content

ObsoleteAttribute inheritance #18

Closed
@amoraller

Description

@amoraller

Nice source generator. Thanks.

If i want delegate implementation to interface with Obsolete methods, i have compilation warnings CS0618.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0618?f1url=%3FappId%3Droslyn%26k%3Dk(CS0618)

For example, i want delegate Nlog.ILogger implmentation.

NLog source coge:

    /// <summary>
    /// Writes the diagnostic message at the <c>Debug</c> level using the specified parameters.
    /// </summary>
    /// <param name="message">A <see langword="string" /> containing format items.</param>
    /// <param name="args">Arguments to format.</param>
    [MessageTemplateFormatMethod("message")]
    void Debug([Localizable(false)][StructuredMessageTemplate] string message, params object[] args);

    /// <summary>
    /// Writes the diagnostic message and exception at the <c>Debug</c> level.
    /// </summary>
    /// <param name="message">A <see langword="string" /> to be written.</param>
    /// <param name="exception">An exception to be logged.</param>
    /// <remarks>This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release.</remarks>
    [Obsolete("Use Debug(Exception exception, string message) method instead. Marked obsolete with v4.3.11")]
    [EditorBrowsable(EditorBrowsableState.Never)]
    void Debug([Localizable(false)] string message, Exception exception);

 
    /// <summary>

Generated code:

    void NLog.ILogger.Debug(string message, params object[] args) => this._nlogImpl.Debug(message, args);

    void NLog.ILogger.Debug(string message, System.Exception exception) => this._nlogImpl.Debug(message, exception);

image

I think, we want nesting Obsolete attribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions