Skip to content

Gendarme.Rules.Interoperability.Com.ComVisibleShouldInheritFromComVisibleRule(git)

Sebastien Pouliot edited this page Mar 2, 2011 · 1 revision

ComVisibleShouldInheritFromComVisibleRule

Assembly: Gendarme.Rules.Interoperability.Com
Version: git

Description

This rule checks that the base type of COM visible types is also visible from COM. This is needed reduce the chance of breaking COM clients as COM invisible types do not have to follow COM versioning rules.

Examples

Bad example:

[assemply: ComVisible(false)]
namespace InteropLibrary {
    [ComVisible (false)]
    public class Base {
    }
    [ComVisible (true)]
    public class Derived : Base {
    }
}

Good example:

[assemply: ComVisible(false)]
namespace InteropLibrary {
    [ComVisible (true)]
    public class Base {
    }
    [ComVisible (true)]
    public class Derived : Base {
    }
}

Good example (both types are invisible because of the assembly attribute):

[assemply: ComVisible(false)]
namespace InteropLibrary {
    public class Base {
    }
    public class Derived : Base {
    }
}

Source code

You can browse the latest source code of this rule on github.com

Clone this wiki locally