Creating a custom FXCop rule based on CA2000 "Dispose Objects Before Losing Scope", which does not apply to System.Web.UI.Control objects

I'm interested in creating a custom rule based on CA2000 "Dispose Objects BeforeLosing Scope" in my ASP.Net web project, which does not apply to objects that are descendants of System.Web.UI.Control. The reason for this is that calling dispose on web controls does not make sense (see here and here for examples).

Is there a way to create my own rule based on an existing FxCop rule? Or is there a way to get the code for this rule, which I could then configure to check the type of object?

+3
source share

All Articles