Home

LINQPad Intellisense and the EditorBrowsibleAttribute

Greetings.

Should LINQPad's Intellisense be respecting the [EditorBrowsable(EditorBrowsableState.Never)] attribute? It currently doesn't seem to, though I'm still researching.

I'm building a prototype to suggest my office use LINQPad as a scripting environment for non-techies. I'm writing an API which is a fluent interface, and I don't want my non-techie users to see System.Object methods in the Intellisense pop-up. So I'm taking an approach similar to KZu's IFluentInterface (https://github.com/kzu/IFluentInterface), which decorates the 4 System.Object methods with the EditorBrowsibleAttribute(Never) so that my users will only see the fluent methods I'm providing.

Unfortunately, this is not yet working in LINQPad - when I add references to my assemblies, and begin coding against my "fluent" types, the 4 Object methods are still showing up in Intellisense.

Before I dig too much farther into my own implementation, I wanted to ask whether this *should* be working in LINQPad.

Thanks.

Comments

  • Still not working as I would expect. I would really like to hide various members from my non-C#-coder users, but I have yet to get EditorBrowsible to be respected by LINQPad at all.

    Anything?
  • Seems to be working for me. (Version v5.09.05)
  • sgmoore - interesting. Can you tell me about your types - concrete classes, or interfaces?
  • sgmoore - actually, respond if you like, but just knowing it works for you answers my question; I'll keep experimenting to sort it out.
    Thanks for the reply.
  • OK, going back to a bare-bones test bench I can see that LINQPad will only properly respect the EditorBrowsable attribute if it is decorating an implementing class' methods directly, not if the attribute is decorating an interface's methods as done in this approach:

    IFluentInterface (https://github.com/kzu/IFluentInterface).

    LINQPad will also respect the attribute if it is applied to overridden methods in a base class, but given the size and complexity of my API, that's not really an option.
  • edited September 2016
    You'll see the same behavior in Visual Studio, and I believe it follows the principle of least surprise.

    It would be confusing if after implicitly implementing members of an interface, you couldn't see those members in Intellisense. Especially if one or more of those members was already defined in your class prior to implementing the interface.

    What do you think?

    And have you considered explicitly implementing the members you wish to hide? They'll then be hidden from the type's public interface, as well as being hidden when cast to the interface.
  • Hmmmm, you're absolutely right that in VS 2015, the System.Object methods *do* appear in Intellisense, which is perplexing, since they haven't always.

    Yes, I've looked at particularly overriding and decorating with [EditorBrowsable] the methods in all my API objects. Quite a pain, but obviously that's the route I'll have to take. Thanks for the attention; and for a great tool.
Sign In or Register to comment.