[Mono-bugs] [Bug 62610][Wis] New - Attaching MarshalAsAttribute via SRE does not work as expected
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 6 Aug 2004 03:28:12 -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=62610
--- shadow/62610 2004-08-06 03:28:12.000000000 -0400
+++ shadow/62610.tmp.23301 2004-08-06 03:28:12.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 62610
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: mathpup@mylinuxisp.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Attaching MarshalAsAttribute via SRE does not work as expected
+
+Description of Problem:
+
+We want to create types (delegates, specifically) using SRE, and we need
+to attach some custom marshaler information to certain parameters.
+Specifically, we want to attach this to them:
+
+[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef =
+typeof(MyMarshal)]
+
+Unfortunately, CustomAttributeBuilder does not seem to handle the custom
+marshaler settings properly. CustomAttributeBuilder.get_umarshal() seems
+to do the work for other types of marshaling, but not for custom
+marshalers.
+
+I know that mcs handles certain attributes as special cases, and with the
+MarshalAs attribute, it uses UnmanagedMarshal.DefineCustom() instead of
+the way that I'm using. Unfortunately, DefineCustom() is a Mono-only
+method and is not portable.
+
+
+
+Steps to reproduce the problem:
+1. gcc -O -o libtest.so -shared custom.c
+2. mcs custom.cs
+3. mono custom.exe
+
+Actual Results:
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in (unmanaged) (wrapper managed-to-native)
+System.Object:__icall_wrapper_mono_delegate_to_ftnptr (object)
+in <0x00004> (wrapper managed-to-native)
+System.Object:__icall_wrapper_mono_delegate_to_ftnptr (object)
+in <0x0002a> (wrapper managed-to-native) Testing:RegisterCallback
+(System.Delegate)
+in <0x00342> Testing:Main ()
+
+
+Expected Results:
+
+Registered
+DoCallback
+MarshalNativeToManaged()
+Method( *Orange* )
+
+
+How often does this happen?
+
+Always
+
+Additional Information: