Skip to content

Embed interop types with internal accessibility #183

@pharring

Description

@pharring

When embedding an interop assembly, the types (interfaces, typically) from that assembly become (or remain) public in the final assembly. This is, usually, not what you want. Particularly for private interops. Indeed, you can see this 'accident' in some Visual Studio assemblies such as Microsoft.VisualStudio.Shell.12.0.dll (look in the Microsoft.Internal.VisualStudio.Shell.Interop namespace)
While we can't change the default behavior without breaking compatibility, I propose a compiler option to change the accessibility of any embedded type to 'internal'. For maximum flexibility, I suppose this option could be applied optionally to each interop embedded. I don't think we need to extend it to the level of an individual type.
Suggestion:
Where today you specify an embedded assembly on the command-line via /link:<file list>, introduce a new option /linkinternal:<file list>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions