[Mono-bugs] [Bug 80437][Nor] New - Reflection.Emit produces invalid binary

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jan 3 06:16:30 EST 2007


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 rolfkvinge at ya.com.

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

--- shadow/80437	2007-01-03 06:16:30.000000000 -0500
+++ shadow/80437.tmp.25088	2007-01-03 06:16:30.000000000 -0500
@@ -0,0 +1,282 @@
+Bug#: 80437
+Product: Mono: Class Libraries
+Version: 1.0
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: rolfkvinge at ya.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Reflection.Emit produces invalid binary
+
+When compiling vbnc Reflection.Emit produces a binary that throws 
+TypeLoadException when run in both Mono and MS.
+
+- Checkout vbnc from svn
+- Apply patch in http://bugzilla.ximian.com/show_bug.cgi?id=80435
+- Download http://bugzilla.ximian.com/showattachment.cgi?attach_id=18432 
+(zip file) and put files in vbnc/tests/SelfTest
+- Run "mono vbnc.exe @SelfCompileLinux.response"
+
+This should produce a SelfCompiled.exe after a couple of minutes, which is 
+the invalid binary. (I also attach the binary here directly).
+
+To load the binary compile the following code with "mono vbnc.exe 
+runner.vb /r:SelfCompiled.exe" (the binary does not have an entry point 
+defined, so this is needed):
+
+public class runner
+        shared sub main(args as string())
+                vbnc.main.main(args)
+        end sub
+end class
+
+then run: "mono runner.exe @SelfCompileLinux.response", and you'll get 
+this:
+
+---------------------------------------------------------------------------
+----------------------------------------------
+Unhandled exception(System.InvalidProgramException): Invalid IL code in 
+vbnc.Nameables`1:AddRange (System.Collections.Generic.ICollection`1): 
+IL_0030: callvirt  0x06000f16
+
+  at <0x00000> <unknown method>
+  at vbnc.Parser.ParseTypeMembers (vbnc.TypeDeclaration Parent, 
+vbnc.MemberDeclarations Members) [0x00541] in /mono/head/vbnc/vbnc/source/
+Parser/Parser.vb:1398
+  at vbnc.Parser.ParseTypeMembers (vbnc.TypeDeclaration Parent) [0x0000d] 
+in /mono/head/vbnc/vbnc/source/Parser/Parser.vb:1304
+  at vbnc.Parser.ParseClassDeclaration (vbnc.ParsedObject Parent, 
+vbnc.Attributes Attributes, System.String Namespace) [0x00172] in /mono/
+head/vbnc/vbnc/source/Parser/Parser(Types).vb:83
+  at vbnc.Parser.ParseTypeDeclaration (vbnc.ParsedObject Parent, 
+vbnc.Attributes Attributes, System.String Namespace) [0x00011] in /mono/
+head/vbnc/vbnc/source/Parser/Parser.vb:1416
+  at vbnc.Parser.ParseAssemblyMembers (vbnc.AssemblyDeclaration Parent, 
+System.String RootNamespace, vbnc.MemberDeclarations result) [0x00088] in /
+mono/head/vbnc/vbnc/source/Parser/Parser.vb:1452
+  at vbnc.Parser.ParseAssemblyDeclaration (System.String 
+RootNamespace) [0x00098] in /mono/head/vbnc/vbnc/source/Parser/
+Parser.vb:420
+  at vbnc.Parser.Parse (System.String RootNamespace) [0x00001] in /mono/
+head/vbnc/vbnc/source/Parser/Parser.vb:51
+  at vbnc.Compiler.Compile_Parse () [0x00083] in /mono/head/vbnc/vbnc/
+source/General/Compiler.vb:353
+  at vbnc.Compiler.Compile () [0x0020e] in /mono/head/vbnc/vbnc/source/
+General/Compiler.vb:498
+InnerException: (Nothing)
+Data.Count: 0
+/mono/head/vbnc/vbnc/source/Parser/Parser.vb:1398 ): Invalid IL code in 
+vbnc.Nameables`1:AddRange (System.Collections.Generic.ICollection`1): 
+IL_0030: callvirt  0x06000f16
+
+/mono/head/vbnc/vbnc/source/Parser/Parser.vb:1304 ): Invalid IL code in 
+vbnc.Nameables`1:AddRange (System.Collections.Generic.ICollection`1): 
+IL_0030: callvirt  0x06000f16
+
+/mono/head/vbnc/vbnc/source/Parser/Parser(Types).vb:83 ): Invalid IL code 
+in vbnc.Nameables`1:AddRange (System.Collections.Generic.ICollection`1): 
+IL_0030: callvirt  0x06000f16
+
+/mono/head/vbnc/vbnc/source/Parser/Parser.vb:1416 ): Invalid IL code in 
+vbnc.Nameables`1:AddRange (System.Collections.Generic.ICollection`1): 
+IL_0030: callvirt  0x06000f16
+
+/mono/head/vbnc/vbnc/source/Parser/Parser.vb:1452 ): Invalid IL code in 
+vbnc.Nameables`1:AddRange (System.Collections.Generic.ICollection`1): 
+IL_0030: callvirt  0x06000f16
+
+/mono/head/vbnc/vbnc/source/Parser/Parser.vb:420 ): Invalid IL code in 
+vbnc.Nameables`1:AddRange (System.Collections.Generic.ICollection`1): 
+IL_0030: callvirt  0x06000f16
+
+/mono/head/vbnc/vbnc/source/Parser/Parser.vb:51 ): Invalid IL code in 
+vbnc.Nameables`1:AddRange (System.Collections.Generic.ICollection`1): 
+IL_0030: callvirt  0x06000f16
+
+/mono/head/vbnc/vbnc/source/General/Compiler.vb:353 ): Invalid IL code in 
+vbnc.Nameables`1:AddRange (System.Collections.Generic.ICollection`1): 
+IL_0030: callvirt  0x06000f16
+
+/mono/head/vbnc/vbnc/source/General/Compiler.vb:498 ): Invalid IL code in 
+vbnc.Nameables`1:AddRange (System.Collections.Generic.ICollection`1): 
+IL_0030: callvirt  0x06000f16
+
+If I try to run with MS, I get:
+---------------------------------------------------------------------------
+----------------------------------------------
+Unhandled exception(System.TypeLoadException): Could not load type 
+'vbnc.Nameables`1' from assembly 'SelfCompile, Version=0.0.0.4802, 
+Culture=neutral,
+ PublicKeyToken=null'.
+(with same stack trace)
+
+
+Notes: running peverify.exe on SelfCompiled.exe gives this, but I don't 
+really know if it's related or not.
+Z:\mono\head\vbnc\vbnc\tests\SelfTest>peverify SelfCompile.exe
+
+Microsoft (R) .NET Framework PE Verifier.  Version  2.0.50727.42
+Copyright (c) Microsoft Corporation.  All rights reserved.
+
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000060. 
+[token:0x0A000011]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A000060]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0000aa. 
+[token:0x0A000068]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0000A6]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000068. 
+[token:0x0A0000AA]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0000B7]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A000161]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A00018D]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A000199]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001db. 
+[token:0x0A0001D7]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A0001DB]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A0001DD]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A0001DF]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A0001E1]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A0001E3]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A0001E7]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A0001EA]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A0001EC]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A0001F4]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A0001FB]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A000202]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A000206]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0001d7. 
+[token:0x0A00020F]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000442. 
+[token:0x0A00022F]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002af. 
+[token:0x0A000283]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002c5. 
+[token:0x0A000286]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A00028E]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0002A1]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0002A2]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0002AF]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0002B1]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0002B8]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0002C0]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0002C2]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000286. 
+[token:0x0A0002C5]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002c9. 
+[token:0x0A0002C8]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002c8. 
+[token:0x0A0002C9]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002cb. 
+[token:0x0A0002CA]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002ca. 
+[token:0x0A0002CB]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002c8. 
+[token:0x0A0002CC]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002ca. 
+[token:0x0A0002CD]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0002CE]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0002CF]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002c8. 
+[token:0x0A0002D0]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002ca. 
+[token:0x0A0002D1]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0002D4]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0002D5]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002c8. 
+[token:0x0A0002DE]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0002E2]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0002E3]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0002E8]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002ef. 
+[token:0x0A0002E9]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0002EA]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002e9. 
+[token:0x0A0002EF]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0002F0]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0002F9]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002c8. 
+[token:0x0A000311]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002ca. 
+[token:0x0A000312]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A000316]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0003D0]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0003DD]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000286. 
+[token:0x0A0003DE]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0003DF]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002e9. 
+[token:0x0A0003E0]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000011. 
+[token:0x0A0003F3]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a00022f. 
+[token:0x0A000442]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0004A5]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0004A7]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0004A9]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0004AA]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0004AB]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0004BE]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002c8. 
+[token:0x0A0004C8]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a0002ca. 
+[token:0x0A0004C9]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000286. 
+[token:0x0A0004CF]
+[MD]: Warning: MemberRef has a duplicate, token=0x0a000283. 
+[token:0x0A0004E2]
+All Classes and Methods in SelfCompile.exe Verified.
+(76 Warnings)


More information about the mono-bugs mailing list