[Mono-bugs] [Bug 76585][Min] New - MethodBase.IsFinal does not seem to return expected value

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Oct 28 16:56:54 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 atsushi at ximian.com.


--- shadow/76585	2005-10-28 16:56:54.000000000 -0400
+++ shadow/76585.tmp.28071	2005-10-28 16:56:54.000000000 -0400
@@ -0,0 +1,55 @@
+Bug#: 76585
+Product: Mono: Runtime
+Version: 1.1
+OS Details: 
+Status: NEW   
+Priority: Minor
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: MethodBase.IsFinal does not seem to return expected value
+The following code prints False under .NET (1.x/2.0) and True under Mono.
+using System;
+using System.Reflection;
+using System.CodeDom;
+public class Test
+        public static void Main ()
+        {
+                Console.WriteLine (typeof (CodeNamespaceImportCollection)
+                        .GetMethod ("Clear").IsFinal);
+        }
+How often does this happen? 
+Additional Information:
+I asked Sebastien to build System.dll (in which
+CodeNamespaceImportCollection resides) with csc, and the result was the
+same. Hence I guess it is not a compiler bug.
+Here is an excerpt from MSDN documentation on MethodBase.IsVirtual (and
+MethodBase.IsFinal as well):
+"To determine if a method is overridable, it is not sufficient to check
+that IsVirtual is true. For a method to be overridable, IsVirtual must be
+true and IsFinal must be false. For example, a method might be non-virtual,
+but it implements an interface method. The common language runtime requires
+that all methods that implement interface members must be marked as
+virtual; therefore, the compiler marks the method virtualfinal. So there
+are cases where a method is marked as virtual but is still not overridable."

More information about the mono-bugs mailing list