[Mono-bugs] [Bug 26204][Nor] Changed - ILGenerator.Emit (OpCodes.Call) must check ReflectedType

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 16 Feb 2005 20:31:14 -0500 (EST)


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 efren.serra.ctr@metnet.navy.mil.

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

--- shadow/26204	2005-02-14 10:45:14.000000000 -0500
+++ shadow/26204.tmp.19981	2005-02-16 20:31:14.000000000 -0500
@@ -10,13 +10,12 @@
 Component: CORLIB
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: lupus@ximian.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
-Cc: 
 Summary: ILGenerator.Emit (OpCodes.Call) must check ReflectedType
 BugsThisDependsOn: 52594
 OtherBugsDependingOnThis: 52586[FIXED]
 
 This bug was posted by Jeroen Frijters" <mono@jeroen.nu> on mono-list.
 If you compile the attached files, like this:
@@ -216,6 +215,121 @@
 I am guessing the rule CSC uses is something more like:
 
 Use the first base type that does not hide the method.
 
 Interestingly, if in a second version that private method is added,
 the client will break if it is not recompiled. 
+
+------- Additional Comments From efren.serra.ctr@metnet.navy.mil  2005-02-16 20:31 -------
+Hello folks,
+ 
+I am not sure if this is a bug; here is the output of `monodis
+usedll.exe':
+.assembly extern testdll
+{
+  .ver 0:0:0:0
+}
+.assembly extern mscorlib
+{
+  .ver 1:0:5000:0
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'usedll'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+.module usedll.exe // GUID = {1E7E6361-2A4E-4371-8951-D07ACA75AC64}
+  
+  
+  .class private auto ansi beforefieldinit test
+        extends [testdll]testdll
+  {
+  
+    // method line 1
+    .method public hidebysig  specialname  rtspecialname
+           instance default void .ctor ()  cil managed
+    {
+        // Method begins at RVA 0x20ec
+        // Code size 7 (0x7)
+        .maxstack 8
+        IL_0000:  ldarg.0
+        IL_0001:  call instance void class [testdll]testdll::.ctor()
+        IL_0006:  ret
+    } // end of method test::instance default void .ctor ()
+  
+    // method line 2
+    .method public static  hidebysig
+           default void Main ()  cil managed
+    {
+        // Method begins at RVA 0x20f4
+        .entrypoint
+        // Code size 21 (0x15)
+        .maxstack 8
+        IL_0000:  ldstr "hello from test: "
+        IL_0005:  newobj instance void class test::.ctor()
+        IL_000a:  call string class
+[mscorlib]System.String::Concat(object, object)
+        IL_000f:  call void class
+[mscorlib]System.Console::WriteLine(string)
+        IL_0014:  ret
+    } // end of method test::default void Main ()
+  
+    // method line 3
+    .method public virtual  hidebysig
+           instance default string ToString ()  cil managed
+    {
+        // Method begins at RVA 0x210c
+        // Code size 17 (0x11)
+        .maxstack 8
+        IL_0000:  ldstr "it's me: "
+        IL_0005:  ldarg.0
+        IL_0006:  call instance string class
+[mscorlib]System.Object::ToString()        IL_000b:  call string class
+[mscorlib]System.String::Concat(string, string)
+        IL_0010:  ret
+    } // end of method test::instance default string ToString ()
+  
+  } // end of class test
+ 
+ 
+The class hierarchy is: Object <- testdll <- test or:
+ 
+             +-------+
+Object  part |       |
+             +-------+
+testdll part |       | <- There are no new fields/methods in here, eh?
+             +-------+
+test    part |       |
+             +-------+
+ 
+Hence, I think the monodis output above is fine.  However, if one does:
+ 
+public class testdll
+{
+  public override string ToString()
+  {
+    return base.ToString();
+  }
+}
+ 
+one gets the lexical scope you refer to above:
+ 
+...
+ // method line 3
+    .method public virtual  hidebysig
+           instance default string ToString ()  cil managed
+
+    {
+        // Method begins at RVA 0x210c
+        // Code size 17 (0x11)
+        .maxstack 8
+        IL_0000:  ldstr "it's me: "
+        IL_0005:  ldarg.0
+        IL_0006:  call instance string class [testdll]testdll::ToString()
+        IL_000b:  call string class
+[mscorlib]System.String::Concat(string, string)
+        IL_0010:  ret
+    } // end
+...
+}
+