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

Diagnostic CodeFix for CS0737: 'C' does not implement interface member 'ITest.M()'. 'C.M()' cannot implement an interface member because it is not public. #25385

Open
MaStr11 opened this issue Mar 9, 2018 · 0 comments
Labels
Milestone

Comments

@MaStr11
Copy link
Contributor

MaStr11 commented Mar 9, 2018

Version Used:
2.8.
Steps to Reproduce:

internal interface I
{
    void M();
}
internal class C: I //CS0737: 'C' does not implement interface member 'I.M()'. 'C.M()' cannot implement an interface member because it is not public.
{
    internal void M() 
    {
    }
}

Expected Behavior:
Offer fix: "Make 'M' public"

internal interface I
{
    void M();
}
internal class C: I
{
    public void M() 
    {
    }
}

Actual Behavior:
"Implement interface" and "Implement interface explicitly" are offered which both generate the exact same explicit interface implementation:

internal interface I
{
   void M();
}
internal class C : I
{
   internal void M()
   {
   }

   void I.M()
   {
       throw new NotImplementedException();
   }
}

https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs0737

There is no corresponding VB diagnostic.

Related #23326.

@jinujoseph jinujoseph added this to the Unknown milestone Apr 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants