[Mono-bugs] [Bug 615553] Marshalling a union results in a crash

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jun 18 21:16:42 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=615553

http://bugzilla.novell.com/show_bug.cgi?id=615553#c1


Zoltan Varga <vargaz at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vargaz at gmail.com

--- Comment #1 from Zoltan Varga <vargaz at gmail.com> 2010-06-19 01:16:41 UTC ---
This:

[StructLayout(LayoutKind.Explicit)]
public struct foobar_t {
     [FieldOffset(0)] public uint foo;
     [FieldOffset(0)] public bar_t bar;
};

will not do what you want it to do, since both fields have the same offset,
the runtime marshaller will overwrite 'foo' with 'bar' when marshalling the
structure from managed to native code, or vice versa.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list