Skip to content

Review COM interface declarations for conflicting ComImport/ComVisible attributes #1860

Open

Description

@weltkante

Follow-up issue from the same problem in dotnet/winforms#1878

There are several interfaces declared with both [ComImport] and [ComVisible(true)] - this is wrong, ComVisible(true) is only for interfaces owned by the assembly. It probably had little consequence while WPF was part of Desktop Framework, but now that it can be deployed with the application these should be corrected, otherwise you risk people corrupting the registry entries owned by Windows.

There probably should be a general review of all ComVisible(true) attributes to make sure annotated classes/code is actually owned by WPF and not just imported. Imported classes/interfaces should use ComImport attributes. A quick search finds 63 matches in 47 files, most in automation, I don't know if those are correct and WPF actually owns them, or if they should be imported instead.

There are a few which are definitely wrong:

Those should all be only ComImport without a ComVisibile, since they are owned by the OS. Having someone attempt to run WPF assemblies deployed with his application through regasm or equivalent tooling (e.g. during an installer) would overwrite the OS registration of those interfaces.

Activity

  1. added
    Bug
    on Sep 19, 2019
  2. added this to the 5.0 milestone on Sep 19, 2019
  3. modified the milestones: 5.0.0, 7.0.0 on Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions