Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Obsolete attribute with array named argument doesn't produce diagnostics #42771

Open
RikkiGibson opened this issue Mar 25, 2020 · 0 comments

Comments

@RikkiGibson
Copy link
Contributor

RikkiGibson commented Mar 25, 2020

Version Used: 441c154

Steps to Reproduce:

using System;
#pragma warning disable 436

namespace System
{
    public class ObsoleteAttribute : Attribute
    {
        public int[] P1 { get; set; }
    }
}

class C1
{
    [Obsolete(
        P1 = new[] { 0 }
    )]
    void M1() { }
    
    void M2()
    {
        M1(); // expect an obsolete diagnostic here but get none
    }
}

Expected Behavior:
Obsolete diagnostic is issued for call to M1().

Actual Behavior:
No diagnostic is issued.

  • If the attribute is modified to not pass an argument for P1, the diagnostic is issued on usage.
  • If the attribute is modified to pass a null argument for P1, the diagnostic is issued on usage.
  • If the obsoleted member is compiled and referenced from metadata, the diagnostic is issued on usage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant