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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=76733 --- shadow/76733 2005-11-16 22:24:32.000000000 -0500 +++ shadow/76733.tmp.21057 2005-11-16 22:24:32.000000000 -0500 @@ -0,0 +1,53 @@ +Bug#: 76733 +Product: Mono: Runtime +Version: 1.1 +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Wishlist +Component: misc +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: LayoutKind.Explicit and out-of-order unions + +This is my struct: + + [StructLayout(LayoutKind.Sequential)] + internal struct XClientMessageEvent { + internal XEventName type; + internal int serial; + internal bool send_event; + internal IntPtr display; + internal IntPtr window; + internal IntPtr message_type; + internal int format; + [StructLayout(LayoutKind.Explicit)] + internal struct DataUnion { + [FieldOffset(0)] internal IntPtr ptr1; + [FieldOffset(4)] internal IntPtr ptr2; + [FieldOffset(8)] internal IntPtr ptr3; + [FieldOffset(12)] internal IntPtr ptr4; + [FieldOffset(16)] internal IntPtr ptr5; + [FieldOffset(0)] [MarshalAs(UnmanagedType.ByValTStr, SizeConst=20)] + internal string str; + } + internal DataUnion data; + } + +When using it I get: + +** ERROR **: Type Egg.XClientMessageEvent/DataUnion which is passed to +unmanaged code must have a StructLayout attribute +aborting... + +This appears to be because the union is constructed out-of-order; if I +place the str member at the start of DataUnion it works OK. + +It's no problem reordering the union, but the error message is highly +confusing. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
