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

Extension methods with EditorBrowsable(Never) defined in a referenced assembly show up in VS intellisense #47551

Closed
jnm2 opened this issue Sep 9, 2020 · 3 comments · Fixed by #47590
Assignees
Labels
Area-IDE Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it IDE-IntelliSense Completion, Signature Help, Quick Info
Milestone

Comments

@jnm2
Copy link
Contributor

jnm2 commented Sep 9, 2020

Version Used: VS 16.7.3

Steps to Reproduce:

  1. Create a library project with a public extension method. Put [EditorBrowsable(EditorBrowsableState.Never)] on it.
  2. Build the project.
  3. Create a second library project and reference the bin/Debug assembly that was created by building the first project.
  4. See the never-browsable extension method showing up in intellisense for the second library project where it offers to autocomplete extension methods that are in an unimported namespace.

Expected Behavior: The extension methods should stop polluting intellisense. They can't be removed without causing binary-breaking changes and they should remain extension methods so that code that used them gets the obsoletion message rather than a "method does not exist" compiler error.

Actual Behavior: The extension methods did not stop polluting intellisense.

@sharwell sharwell added Area-IDE Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it IDE-IntelliSense Completion, Signature Help, Quick Info labels Sep 9, 2020
@sharwell sharwell added this to the Backlog milestone Sep 9, 2020
@Youssef1313
Copy link
Member

Related existing test:

[WorkItem(7336, "DevDiv_Projects/Roslyn")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task EditorBrowsable_ExtensionMethod_BrowsableNever()
{
var markup = @"
class Program
{
void M()
{
new Goo().$$
}
}";
var referencedCode = @"
public class Goo
{
}
public static class GooExtensions
{
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Bar(this Goo goo, int x)
{
}
}";
await VerifyItemInEditorBrowsableContextsAsync(
markup: markup,
referencedCode: referencedCode,
item: "Bar",
expectedSymbolsSameSolution: 1,
expectedSymbolsMetadataReference: 0,
sourceLanguage: LanguageNames.CSharp,
referencedLanguage: LanguageNames.CSharp);
}

@jnm2
Copy link
Contributor Author

jnm2 commented Sep 12, 2020

Thanks, that was quite fast! Will the fixed version be 16.8.x?

@genlu
Copy link
Member

genlu commented Sep 14, 2020

Will the fixed version be 16.8.x?

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it IDE-IntelliSense Completion, Signature Help, Quick Info
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants