Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Mono aligns struct sizes and offsets to 8 for performance reasons, this can cause differences versus .net.
Thanks for the response, I can understand the reason but we have a situation where a C based library (both on linux and Windows) provides a decode stream of bytes and we just type cast it required structure type in C#. It works in .Net and also with gmcs built binary when run on Windows. Only with mono on linux it fails.
Can we have some option in mono to execute binary on linux with same layout as Windows. Even if it is not best performing it is not a big issue with us currently.
Any comments on this one?
As a workaround, try inlining the inner structure members into the outer structure.
As workaround, use struct layout custom attributes to control size, alignment and offsets.
This is not a bug in mono, it's a platform difference to with portable code must care for.
This is actually a bug in mono.
Where's the bug?
This seems to work with mono 3.4.0.