[Mono-bugs] [Bug 47295][Nor] New - Marshal.StructureToPtr fails with dynamically-created MulticastDelegate subclasses

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Sat, 2 Aug 2003 20:22:26 -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 mathpup@mylinuxisp.com.

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

--- shadow/47295	Sat Aug  2 20:22:26 2003
+++ shadow/47295.tmp.10376	Sat Aug  2 20:22:26 2003
@@ -0,0 +1,66 @@
+Bug#: 47295
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Marshal.StructureToPtr fails with dynamically-created MulticastDelegate subclasses
+
+Description of Problem: 
+ 
+The main idea here is that I need to create callbacks so that unmanaged code can 
+call managed code. I am creating subclasses of MulticastDelegate at runtime. I then 
+store instances of these delegate types into a struct and use Marshal.StructureToPtr 
+to copy the delegates into unmanaged memory. During the copying, the standard 
+marshaler turns the delegates into function pointers that unmanaged can call. 
+ 
+The test program creates a delegate type at runtime, then creates an instance of 
+the delegate and invokes it. This part works fine under Rotor and Mono. Copying the 
+struct that contains the delegate using StructureToPtr works under Rotor but fails 
+under Mono with the following: 
+ 
+** ERROR **: file metadata.c: line 909 (mono_metadata_decode_row_col): 
+assertion failed: (col < mono_metadata_table_count (bitfield)) 
+aborting... 
+ 
+ 
+ 
+ 
+Steps to reproduce the problem: 
+1. mcs dynamicdelegate.cs 
+2. mono dynamicdelegate.exe 
+ 
+ 
+Actual Results: 
+ 
+Method( 8 ) 
+ 
+** ERROR **: file metadata.c: line 909 (mono_metadata_decode_row_col): 
+assertion failed: (col < mono_metadata_table_count (bitfield)) 
+aborting... 
+ 
+ 
+Expected Results: 
+ 
+Method( 8 ) 
+ 
+(no error) 
+ 
+ 
+ 
+How often does this happen?  
+ 
+Always 
+ 
+ 
+Additional Information: