FXCop and Asp.net sample programs

  • Thread starter Thread starter Nick nkw
  • Start date Start date
N

Nick nkw

I tried to use FxCop on the sample of
http://asp.net/learn/dataaccess/default.aspx?tabid=63

And I got the following error. Basically the code defined a member with type
of TableAdapter and no Disposable method is defined. It sounds it's not
necessary in the samples.

Should I have a empty Dispose method always in this case?
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// dispose managed resources, leave it empty

}
}

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}


CriticalError, Certainty 95, for
TypesThatOwnDisposableFieldsShouldBeDisposable
{
Target : EmployeesBLL (IntrospectionTargetType)
Resolution : "Implement IDisposable on 'EmployeesBLL' as it
instantiates members of the following IDisposable types:
NorthwindTableAdapters.EmployeesTableAdapter"
Help :
http://www.gotdotnet.com/team/fxcop...hatOwnDisposableFieldsShouldBeDisposable.html
(String)
Category : Microsoft.Design (String)
CheckId : CA1001 (String)
RuleFile : Design Rules (String)
Info : "Types that declare disposable members should also
implement
IDisposable. If the type does not own any unmanaged
resources, do not implement a finalizer on it."
Created : 3/5/2007 9:00:10 PM (DateTime)
LastSeen : 3/5/2007 9:00:10 PM (DateTime)
Status : Active (MessageStatus)
Fix Category : Breaking (FixCategories)
}
 
Some of the rules need to be ignored. I think this one can because a
tableadapter doesn't usually wrap unmanaged resources.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
 
Back
Top