Export (0) Print
Expand All

Avoid static members in ComVisible types

TypeName

AvoidStaticMembersInComVisibleTypes

CheckId

CA1407

Category

Microsoft.Interoperability

Breaking Change

NonBreaking

A type that is specifically marked as visible to COM contains a public static method.

COM does not support static methods.

This rule ignores property and event accessors, operator overloading methods or methods marked with the System.Runtime.InteropServices.ComRegisterFunctionAttribute attribute or the System.Runtime.InteropServices.ComUnregisterFunctionAttribute attribute.

By default, the following are visible to COM: assemblies, public types, public instance members in public types, and all members of public value types.

To fix a violation of this rule, change the design to use an instance method that provides the same functionality as the static method.

It is safe to exclude a warning from this rule if a COM client does not need access to the functionality provided by the static method.

Community Additions

ADD
Show:
© 2014 Microsoft