[Mono-bugs] [Bug 68850][Wis] New - Compiler crashes processing MarshalAs

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 27 Oct 2004 11:24:27 -0400 (EDT)


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 neale.ferguson@softwareag-usa.com.

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

--- shadow/68850	2004-10-27 11:24:27.000000000 -0400
+++ shadow/68850.tmp.23187	2004-10-27 11:24:27.000000000 -0400
@@ -0,0 +1,81 @@
+Bug#: 68850
+Product: Mono: Compilers
+Version: unspecified
+OS: other
+OS Details: W2K & SLES9 on S390
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: Neale.Ferguson@SoftwareAG-usa.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Compiler crashes processing MarshalAs
+
+Description of Problem:
+Compiler "crashes" when compiling a program containing
+[MarshalAs(UnmanagedType.ByValArray, SizeParamIndex=2)] within a function
+prototype.
+
+Test Case:
+
+using System;
+using System.Text;
+using System.Runtime.InteropServices;
+
+public class main {
+
+                [DllImport("libname", EntryPoint = "scumbag")]
+                private unsafe static extern int scumbag(ref int X,
+                [MarshalAs(UnmanagedType.ByValArray, SizeParamIndex=2)] ref
+byte[] fb,
+                long  lFb,
+                [MarshalAs(UnmanagedType.ByValArray, SizeParamIndex=4)] ref
+byte[] rb,
+                long  lRb,
+                [MarshalAs(UnmanagedType.ByValArray, SizeParamIndex=6)] ref
+byte[] sb,
+                long  lSb,
+                [MarshalAs(UnmanagedType.ByValArray, SizeParamIndex=8)] ref
+byte[] vb,
+                long  lVb,
+                [MarshalAs(UnmanagedType.ByValArray, SizeParamIndex=10)]
+ref byte[] ib,
+                long  lIb);
+
+        static void Main() {
+                int rc;
+                Console.WriteLine("Waiting..");
+                string line = Console.ReadLine();
+        }
+
+}
+
+Test Results:
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x0000034c> Mono.CSharp.Attribute:GetMarshal ()
+in <0x00000054> Mono.CSharp.ParameterBase:ApplyAttributeBuilder
+(Mono.CSharp.Attribute,System.Reflection.Emit.CustomAttributeBuilder)
+in <0x0000009c> Mono.CSharp.Parameter:ApplyAttributeBuilder
+(Mono.CSharp.Attribute,System.Reflection.Emit.CustomAttributeBuilder)
+in <0x000001a4> Mono.CSharp.Attribute:Emit
+(Mono.CSharp.EmitContext,Mono.CSharp.Attributable,System.Collections.Specialized.ListDictionary)
+in <0x0000011c> Mono.CSharp.Attributes:Emit
+(Mono.CSharp.EmitContext,Mono.CSharp.Attributable)
+in <0x0000012c> Mono.CSharp.Parameter:DefineParameter
+(Mono.CSharp.EmitContext,System.Reflection.Emit.MethodBuilder,System.Reflection.Emit.ConstructorBuilder,int,Mono.CSharp.Location)
+in <0x00000158> Mono.CSharp.Parameters:LabelParameters
+(Mono.CSharp.EmitContext,System.Reflection.MethodBase,Mono.CSharp.Location)
+in <0x0000027a> Mono.CSharp.MethodData:Emit
+(Mono.CSharp.TypeContainer,Mono.CSharp.Attributable)
+in <0x00000032> Mono.CSharp.Method:Emit ()
+in <0x000007d2> Mono.CSharp.TypeContainer:EmitType ()
+in <0x00000672> Mono.CSharp.RootContext:EmitCode ()
+in <0x00001334> Mono.CSharp.Driver:MainDriver (string[])
+in <0x00000026> Mono.CSharp.Driver:Main (string[])