How to fix System.TypeLoadException when declaring structs with union?
问题 Receiving System.TypeLoadException in runtime. I use code from third-party source to define structs and p-invoke external methods. I found the full code online in this link. In the code there are some structs with union, using FieldOffsetAttribute(0) on multiple fields. when I try to use some of the structs I get an exception: Could not load type 'NET_DVR_SLAVE_CHANNEL_UNION' from assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because it contains an object