[Mono-bugs] [Bug 75091][Nor] New - wrong base types

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun May 29 17:33:00 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 dsilva at ccs.neu.edu.

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

--- shadow/75091	2005-05-29 17:33:00.000000000 -0400
+++ shadow/75091.tmp.27385	2005-05-29 17:33:00.000000000 -0400
@@ -0,0 +1,309 @@
+Bug#: 75091
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Mono.Cecil
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: dsilva at ccs.neu.edu               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: wrong base types
+
+Description of Problem:
+
+Cecil is reporting incorrect base types.
+
+
+Steps to reproduce the problem:
+
+$ cat Foo.cs
+
+public class Foo {}
+
+$ cat CecilTest.cs
+using System;
+using Mono.Cecil;
+
+public class CecilTest {
+  public static void Main(string[] args) {
+    IAssemblyDefinition asm = AssemblyFactory.GetAssembly(args[0]);
+    foreach (IModuleDefinition mod in asm.Modules) {
+      Console.WriteLine("Module {0}", mod.Name);
+      foreach (ITypeDefinition t in mod.Types) {
+        Console.WriteLine("\tType {0} extends {1}", t, t.BaseType);
+      }
+    }
+  }
+}
+
+
+public abstract class Bar : Foo {}
+
+$ mcs -target:library Foo.cs
+$ mcs -r:Foo.dll -r:$CECIL/Mono.Cecil.dll CecilTest.cs
+$ export MONO_PATH=$CECIL:$MONO_PATH
+$ mono CecilTest.exe CecilTest.exe
+Module CecilTest.exe
+        Type <Module> extends System.Object
+        Type Bar extends
+        Type CecilTest extends Foo
+
+
+Actual Results:
+
+Module CecilTest.exe
+        Type <Module> extends System.Object
+        Type Bar extends
+        Type CecilTest extends Foo
+
+Expected Results:
+
+Module CecilTest.exe
+        Type <Module> extends
+        Type Bar extends Foo
+        Type CecilTest extends System.Object
+
+How often does this happen? 
+
+
+Additional Information:
+
+Here are the disassemblies for Foo.dll and CecilTest.exe.
+
+
+$ monodis Foo.dll
+.assembly extern mscorlib
+{
+  .ver 1:0:5000:0
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'Foo'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+.module Foo.dll // GUID = {3667D27D-C755-4D18-BEB4-08C998FA00E9}
+
+
+  .class public auto ansi beforefieldinit Foo
+        extends [mscorlib]System.Object
+  {
+
+    // 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 [mscorlib]System.Object::.ctor()
+        IL_0006:  ret
+    } // end of method Foo::instance default void .ctor ()
+
+  } // end of class Foo
+
+$ monodis CecilTest.exe >/dev/null
+
+** (process:24750): WARNING **: Could not find assembly Mono.Cecil,
+references from
+/home/dsilva/tmp/cs/ca/contract-attributes/bin/CecilTest.exe
+(assemblyref_index=1)
+     Major/Minor: 0,0
+     Build:       1975,14820
+     Token:
+System error: No such file or directory
+
+
+** (process:24750): WARNING **: Could not load class from
+Mono.Cecil.IAssemblyDefinition (token 0x01000002) in
+/home/dsilva/tmp/cs/ca/contract-attributes/bin/CecilTest.exe
+
+** (process:24750): WARNING **: Could not load class from
+Mono.Cecil.IModuleDefinition (token 0x01000007) in
+/home/dsilva/tmp/cs/ca/contract-attributes/bin/CecilTest.exe
+
+** (process:24750): WARNING **: Could not load class from
+Mono.Cecil.ITypeDefinition (token 0x0100000a) in
+/home/dsilva/tmp/cs/ca/contract-attributes/bin/CecilTest.exe
+Segmentation fault
+
+$ ln -s $CECIL/Mono.Cecil.dll
+$ monodis CecilTest.exe >/dev/null
+$ monodis CecilTest.exe
+
+.assembly extern mscorlib
+{
+  .ver 1:0:5000:0
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly extern Mono.Cecil
+{
+  .ver 0:0:1975:14820
+}
+.assembly extern Foo
+{
+  .ver 0:0:0:0
+}
+.assembly 'CecilTest'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+.module CecilTest.exe // GUID = {DCB9E514-AC6A-475D-BABE-151481B545E5}
+
+
+  .class public auto ansi beforefieldinit CecilTest
+  	extends [mscorlib]System.Object
+  {
+
+    // 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 [mscorlib]System.Object::.ctor()
+	IL_0006:  ret 
+    } // end of method CecilTest::instance default void .ctor () 
+
+    // method line 2
+    .method public static  hidebysig 
+           default void Main (string[] args)  cil managed 
+    {
+        // Method begins at RVA 0x20f4
+	.entrypoint
+	// Code size 181 (0xb5)
+	.maxstack 28
+	.locals init (
+		class [Mono.Cecil]Mono.Cecil.IAssemblyDefinition	V_0,
+		class [Mono.Cecil]Mono.Cecil.IModuleDefinition	V_1,
+		class [Mono.Cecil]Mono.Cecil.ITypeDefinition	V_2,
+		class [mscorlib]System.Collections.IEnumerator	V_3,
+		class [mscorlib]System.Collections.IEnumerator	V_4)
+	IL_0000:  ldarg.0 
+	IL_0001:  ldc.i4.0 
+	IL_0002:  ldelem.ref 
+	IL_0003:  call class [Mono.Cecil]Mono.Cecil.IAssemblyDefinition class
+[Mono.Cecil]Mono.Cecil.AssemblyFactory::GetAssembly(string)
+	IL_0008:  stloc.0 
+	IL_0009:  ldloc.0 
+	IL_000a:  callvirt instance class
+[Mono.Cecil]Mono.Cecil.IModuleDefinitionCollection class
+[Mono.Cecil]Mono.Cecil.IAssemblyDefinition::get_Modules()
+	IL_000f:  callvirt instance class [mscorlib]System.Collections.IEnumerator
+class [mscorlib]System.Collections.IEnumerable::GetEnumerator()
+	IL_0014:  stloc.3 
+	.try { // 1
+	  IL_0015:  ldloc.3 
+	  IL_0016:  callvirt instance bool class
+[mscorlib]System.Collections.IEnumerator::MoveNext()
+	  IL_001b:  brfalse IL_0099
+
+	  IL_0020:  ldloc.3 
+	  IL_0021:  callvirt instance object class
+[mscorlib]System.Collections.IEnumerator::get_Current()
+	  IL_0026:  castclass [Mono.Cecil]Mono.Cecil.IModuleDefinition
+	  IL_002b:  stloc.1 
+	  IL_002c:  ldstr "Module {0}"
+	  IL_0031:  ldloc.1 
+	  IL_0032:  callvirt instance string class
+[Mono.Cecil]Mono.Cecil.IModuleDefinition::get_Name()
+	  IL_0037:  call void class [mscorlib]System.Console::WriteLine(string,
+object)
+	  IL_003c:  ldloc.1 
+	  IL_003d:  callvirt instance class
+[Mono.Cecil]Mono.Cecil.ITypeDefinitionCollection class
+[Mono.Cecil]Mono.Cecil.IModuleDefinition::get_Types()
+	  IL_0042:  callvirt instance class
+[mscorlib]System.Collections.IEnumerator class
+[mscorlib]System.Collections.IEnumerable::GetEnumerator()
+	  IL_0047:  stloc.s 4
+	  .try { // 0
+	    IL_0049:  ldloc.s 4
+	    IL_004b:  callvirt instance bool class
+[mscorlib]System.Collections.IEnumerator::MoveNext()
+	    IL_0050:  brfalse IL_0078
+
+	    IL_0055:  ldloc.s 4
+	    IL_0057:  callvirt instance object class
+[mscorlib]System.Collections.IEnumerator::get_Current()
+	    IL_005c:  castclass [Mono.Cecil]Mono.Cecil.ITypeDefinition
+	    IL_0061:  stloc.2 
+	    IL_0062:  ldstr "\tType {0} extends {1}"
+	    IL_0067:  ldloc.2 
+	    IL_0068:  ldloc.2 
+	    IL_0069:  callvirt instance class
+[Mono.Cecil]Mono.Cecil.ITypeReference class
+[Mono.Cecil]Mono.Cecil.ITypeDefinition::get_BaseType()
+	    IL_006e:  call void class [mscorlib]System.Console::WriteLine(string,
+object, object)
+	    IL_0073:  br IL_0049
+
+	    IL_0078:  leave IL_0094
+
+	  } // end .try 0
+	  finally  { // 0
+	    IL_007d:  ldloc.s 4
+	    IL_007f:  isinst [mscorlib]System.IDisposable
+	    IL_0084:  dup 
+	    IL_0085:  brtrue.s IL_008d
+
+	    IL_0087:  pop 
+	    IL_0088:  br IL_0092
+
+	    IL_008d:  callvirt instance void class
+[mscorlib]System.IDisposable::Dispose()
+	    IL_0092:  endfinally 
+	    IL_0093:  endfinally 
+	  } // end handler 0
+	  IL_0094:  br IL_0015
+
+	  IL_0099:  leave IL_00b4
+
+	} // end .try 1
+	finally  { // 1
+	  IL_009e:  ldloc.3 
+	  IL_009f:  isinst [mscorlib]System.IDisposable
+	  IL_00a4:  dup 
+	  IL_00a5:  brtrue.s IL_00ad
+
+	  IL_00a7:  pop 
+	  IL_00a8:  br IL_00b2
+
+	  IL_00ad:  callvirt instance void class
+[mscorlib]System.IDisposable::Dispose()
+	  IL_00b2:  endfinally 
+	  IL_00b3:  endfinally 
+	} // end handler 1
+	IL_00b4:  ret 
+    } // end of method CecilTest::default void Main (string[] args) 
+
+  } // end of class CecilTest
+
+  .class public auto ansi abstract beforefieldinit Bar
+  	extends [Foo]Foo
+  {
+
+    // method line 3
+    .method family hidebysig  specialname  rtspecialname 
+           instance default void .ctor ()  cil managed 
+    {
+        // Method begins at RVA 0x21ec
+	// Code size 7 (0x7)
+	.maxstack 8
+	IL_0000:  ldarg.0 
+	IL_0001:  call instance void class [Foo]Foo::.ctor()
+	IL_0006:  ret 
+    } // end of method Bar::instance default void .ctor () 
+
+  } // end of class Bar


More information about the mono-bugs mailing list