Fix bug 18941: Marshal.OffsetOf and Marshal.SizeOf return incorrect results (#7142)
commit798c5efa52ada6cd4057f385b2bc7b78b57003ed
authorKatelyn Gadd <kg@luminance.org>
Fri, 23 Feb 2018 16:49:21 +0000 (23 08:49 -0800)
committerLudovic Henry <luhenry@microsoft.com>
Fri, 23 Feb 2018 16:49:21 +0000 (23 11:49 -0500)
treebdeda506d2088d123018a7dac577d75c3fa1c598
parent1f0fc93de4c6a36f3c52229d335762c322a65281
Fix bug 18941: Marshal.OffsetOf and Marshal.SizeOf return incorrect results (#7142)

* Add test for bug 18941

* Expand and update bug 18941 test because there are more problems with our handling of empty structs

* Remove array offset calculation from test because it uses unmanaged sizes. Fix calculation of struct sizes used in marshal struct layout (fixes SizeOf(TestOffsets))

* Correct Marshal.SizeOf implementation to use mono_marshal_type_size instead of returning native sizes

* Remove commented out code
mono/metadata/marshal.c
mono/tests/Makefile.am
mono/tests/sizeof-empty-structs.cs [new file with mode: 0644]