[Mono-bugs] [Bug 68932][Cri] New - ** ERROR **: Invalid IL code at IL0031

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 29 Oct 2004 10:44:05 -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 aotto1968@onlinehome.de.

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

--- shadow/68932	2004-10-29 10:44:05.000000000 -0400
+++ shadow/68932.tmp.4114	2004-10-29 10:44:05.000000000 -0400
@@ -0,0 +1,80 @@
+Bug#: 68932
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: SuSE 9.0
+Status: NEW   
+Resolution: 
+Severity: 160 One month
+Priority: Critical
+Component: IL assembler
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: aotto1968@onlinehome.de               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ** ERROR **: Invalid IL code at IL0031
+
+>> 
+** ERROR **: Invalid IL code at IL0031 in (wrapper native-to-managed) 
+Msgque.Context:_GENERIC (intptr,intptr): IL_0031: ret 
+ 
+Description of Problem: >>>>>>>>>>>>>>>>>>>>>>>> 
+ 
+namespace Msgque { 
+  public delegate ErrorE HdlF(IntPtr msgque, IntPtr data); 
+  public enum ErrorE { OK, ERROR, WARNING, CONTINUE }; 
+  public abstract class Context { 
+    ... 
+    [DllImport(MSGQUE_DLL)] 
+    protected static extern ErrorE MqTokenAddHdl(IntPtr tokenP, string 
+token, HdlF handle, IntPtr data); 
+    ... 
+    [DllImport(MSGQUE_DLL)] 
+    private static extern void MqTransSetResult(IntPtr msgque, TransE 
+tstatus, int ret); 
+ 
+    protected ErrorE _GENERIC (IntPtr msgque, IntPtr data) { 
+      object[] ret = new Object[1] { (short) 9}; 
+      int hc = ret.GetHashCode(); 
+      retHT.Add(hc, ret); 
+      MqTransSetResult(msgque, TransE.END, hc); 
+      return ErrorE.OK; 
+    } 
+    ... 
+  } 
+} 
+ 
+public class Test : Msgque.Context 
+{ 
+  ... 
+  public static void Main() 
+  {    
+    Test CTX = new Test(...); 
+    MqTokenAddHdl (CTX.msgque.retT, "ECO2", new Msgque.HdlF(CTX._GENERIC), 
+IntPtr.Zero); 
+    /// create a transaction and wait until "_GENERIC" handle get fired 
+  } 
+} 
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
+ 
+Solution of the Problem: 
+if you cange "ErrorE" in HdlF to int and change _GENERIC return to int 
+(e.g. return (int) ErrorE.OK;} everything works well 
+ 
+-> Problem: delegate with enum return in a PInvoke environment !!!! 
+ 
+Actual Results: 
+** ERROR **: Invalid IL code at IL0031 in (wrapper native-to-managed) 
+Msgque.Context:_GENERIC (intptr,intptr): IL_0031: ret 
+ 
+Expected Results: 
+no error, microsoft csc compile and run the code without error 
+ 
+ 
+How often does this happen?  
+everytime 
+ 
+ 
+Additional Information: