'field' : Instance field types marked with structlayout(LayoutKind.Explicit) must have a structoffset attribute.
When a struct is marked with an explicit structlayout attribute, all fields in the struct must have the structoffset attribute.
The following sample generates CS0625:
using System; using System.Interop; [structlayout(LayoutKind.Explicit)] struct Worksheet { // uncomment the next line to resolve // [structoffset(5)] public int i; // not marked static, i.e., an instance field } public class MainClass { public static void Main () { } }