dotnet/runtime
在 GitHub 查看[mono] System.Reflection.Emit doesn't propagate marshalling attributes to the created type
Open
#58,783 建立於 2021年9月8日
area-VM-reflection-monohelp wanted
倉庫指標
- Star
- (17,886 star)
- PR 合併指標
- (平均合併 12天 11小時) (30 天內合併 661 個 PR)
描述
See the comment below for a concise repro: https://github.com/dotnet/runtime/issues/58783#issuecomment-915439461
Some values relevant to marshaling from a StructLayoutAttribute and MarshalAsAttribute are not propagated to the dynamically created type.
Original bug report:
I tested it in Xamarin, but dotnet runtime also exists:

The correct size should be 100, which is correct on .net framework but wrong on mono. When I debug this code with mono on win, I found that this error is related to mono’s implementation of DynamicImage, which is caused by the attribute not being successfully applied during marshal.