I've inherited a large legacy ASP.NET application where I work, and our company wants us to use FxCop and fix all major rule violations. Currently a rule that seems to be prevalent is the following:
CA1405: COM visible type base types should be COM visible
It appears that every ASP.NET page/control in our application is violating this rule. I wasn't sure why at first, but eventually I realized it is due to the following inheritance chain:
System.IDisposable → System.Web.UI.Control → System.Web.UI.TemplateControl → System.Web.UI.Page
I also realized IDisposable
is defined as:
[ComVisible(true)]
public interface IDisposable
{
void Dispose();
}
To summarize: all ASP.NET pages/controls inherit from IDisposable
, and IDisposable
has the [ComVisible(true)]
attribute, which means all pages/controls will fail this rule.
This is hurting us because our application has thousands of pages and controls, and thus thousands of violations. Disabling the rule is not an option, as we have a "company standard" set of FxCop rules. It seems that FxCop wants us to go through and put this attribute on every single page in our application, which I really am not interested in doing.
My question is, why does IDisposable
have the [ComVisible(true)]
attribute in the first place?