[Mono-bugs] [Bug 73457][Nor] New - Mono not using the basetype for getting value of VALUETYPE(enum) from the constant table

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 8 Mar 2005 00:37:19 -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 radical@gmail.com.


--- shadow/73457	2005-03-08 00:37:19.000000000 -0500
+++ shadow/73457.tmp.19630	2005-03-08 00:37:19.000000000 -0500
@@ -0,0 +1,94 @@
+Bug#: 73457
+Product: Mono: Runtime
+Version: unspecified
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: radical@gmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Mono not using the basetype for getting value of VALUETYPE(enum) from the constant table
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+If a default value is specified for a "[opt] valuetype" method parameter
+and assembled, mono gives a warning : 
+** (/home/ankit/mono-s/misc-s//lib/mono/1.0/mbas.exe:14136): WARNING **:
+type 0x11 should not be in constant table
+type 0x11 corresponds to MONO_TYPE_VALUETYPE.
+For eg. 
+    .method public hidebysig static void ^M
+            foo([opt] valuetype Ankit.Test.menum a) cil managed
+    {
+       .param[1] = int32 (0x4)
+Basically, mono is taking the type as VALUETYPE in
+mono_get_object_from_blob instead of taking its basetype.
+I'm attaching two files: t3.il and a.vb.
+$ ilasm.exe /dll t3.il
+$ vbc.exe -r:t3.dll a.vb
+The generated a.exe runs fine on ms.net, but gives the warning on mono.
+Compiling a.vb with mbas and the /r:t3.dll also gives the same warning.
+Actual Results:
+mbas -r:./t3.dll a.vb 
+MonoBASIC Compiler - (c)2002, 2003, 2004, 2005 Rafael Teixeira
+** (/home/ankit/mono-s/misc-s//lib/mono/1.0/mbas.exe:14136): WARNING **:
+type 0x11 should not be in constant table
+error BC-0001: Internal Error : cannot handle the data typereceived from
+ParameterInfo class
+Exception: System.NullReferenceException: Object reference not set to an
+instance of an object
+in <0x0032f> Mono.MonoBASIC.Invocation:ConstructArgumentList
+(Mono.MonoBASIC.EmitContext ec, System.Collections.ArrayList Arguments,
+System.Reflection.MethodBase method)
+in <0x0052c> Mono.MonoBASIC.Invocation:OverloadResolve
+(Mono.MonoBASIC.EmitContext ec, Mono.MonoBASIC.MethodGroupExpr me,
+System.Collections.ArrayList Arguments, Location loc)
+in <0x0049b> Mono.MonoBASIC.Invocation:DoResolve
+(Mono.MonoBASIC.EmitContext ec)
+in <0x0016d> Mono.MonoBASIC.Expression:Resolve (Mono.MonoBASIC.EmitContext
+ec, ResolveFlags flags)
+in <0x00012> Mono.MonoBASIC.Expression:Resolve (Mono.MonoBASIC.EmitContext ec)
+in <0x0001d> Mono.MonoBASIC.StatementExpression:Resolve
+(Mono.MonoBASIC.EmitContext ec)
+in <0x00167> Mono.MonoBASIC.Block:Resolve (Mono.MonoBASIC.EmitContext ec)
+in <0x000cc> Mono.MonoBASIC.EmitContext:EmitTopBlock (Mono.MonoBASIC.Block
+block, System.String bname, Mono.MonoBASIC.InternalParameters ip, Location loc)
+in <0x0044d> Mono.MonoBASIC.MethodData:Emit (Mono.MonoBASIC.TypeContainer
+parent, Mono.MonoBASIC.Block block, System.Object kind)
+in <0x00031> Mono.MonoBASIC.Method:Emit (Mono.MonoBASIC.TypeContainer parent)
+in <0x00253> Mono.MonoBASIC.TypeContainer:Emit ()
+in <0x0030d> Mono.MonoBASIC.RootContext:EmitCode ()
+in <0x0003f> Mono.Languages.Driver:GenerateAssembly ()
+in <0x0004b> Mono.Languages.Driver:CompileAll ()
+Compilation failed: 1 Error(s), 0 warnings
+Expected Results:
+How often does this happen? 
+Additional Information:
+Proposed patch is also attached.