[Mono-bugs] [Bug 76329][Min] New - Some System.Drawing class don't use GC.SuppressFinalize in their Dispose method

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Oct 4 16:05:20 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by sebastien at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=76329

--- shadow/76329	2005-10-04 16:05:20.000000000 -0400
+++ shadow/76329.tmp.20274	2005-10-04 16:05:20.000000000 -0400
@@ -0,0 +1,74 @@
+Bug#: 76329
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: Sys.Drawing.
+AssignedTo: jordi at ximian.com                            
+ReportedBy: sebastien at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Some System.Drawing class don't use GC.SuppressFinalize in their Dispose method
+
+Description of Problem:
+
+The three following classes implements IDisposable but don't call
+GC.SuppressFinalize. This reduce performance as the destructor will be
+called (even if it's no more required).
+
+* System.Drawing.FontFamily
+* System.Drawing.Graphics
+* System.Drawing.Imaging.EncoderParameter
+
+Steps to reproduce the problem:
+1. This was caught with a "pre-SVN" version of "gendarme"
+
+Actual Results:
+
+Gendarme
+Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+
+1. IDisposableWithDestructorWithoutSuppressFinalizeRule
+
+Problem: The type 'System.Drawing.FontFamily' has a destructor and
+implements IDisposable. However it doesn't call System.GC.SuppressFinalize
+inside it's Dispose method.
+
+Solution: Remove the empty destructor (or Finalize method) from the class.
+
+More info available at: http://www.mono-project.com/
+
+2. IDisposableWithDestructorWithoutSuppressFinalizeRule
+
+Problem: The type 'System.Drawing.Graphics' has a destructor and implements
+IDisposable. However it doesn't call System.GC.SuppressFinalize inside it's
+Dispose method.
+
+Solution: Remove the empty destructor (or Finalize method) from the class.
+
+More info available at: http://www.mono-project.com/
+
+3. IDisposableWithDestructorWithoutSuppressFinalizeRule
+
+Problem: The type 'System.Drawing.Imaging.EncoderParameter' has a
+destructor and implements IDisposable. However it doesn't call
+System.GC.SuppressFinalize inside it's Dispose method.
+
+Solution: Remove the empty destructor (or Finalize method) from the class.
+
+More info available at: http://www.mono-project.com/
+
+Expected Results:
+* No warning from gendarme.
+
+How often does this happen? 
+* Always
+
+Additional Information:
+* None.


More information about the mono-bugs mailing list