Skip to content

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

Sebastien Pouliot edited this page Jan 22, 2011 · 2 revisions

ComVisibleShouldInheritFromComVisibleRule

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

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 {
    }
}
Clone this wiki locally