By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,543 Members | 2,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,543 IT Pros & Developers. It's quick & easy.

Error: it contains an object field at offset 75 that is incorrectly aligned

P: 4
Error as like this-->object field at offset 75 that is incorrectly aligned or overlapped by a non-object field. But here size constant is 3 so I think after 72 offset will be 75..If I change the offset to 76 it will works fine. I think reason is that size of int is 4. After changing that code will be like this.
Expand|Select|Wrap|Line Numbers
  1. [FieldOffset(72)]
  2.             [MarshalAs(UnmanagedType.ByValArray,SizeConst= 3)]
  3.             public int[] DC;
  4.  
  5.             [FieldOffset(76)]
  6.             [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
  7.             public float[] WIN;
  8.  
  9.  
  10.             [FieldOffset(84)]
  11.             [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
  12.             public byte[] name;
  13.  
  14.             [FieldOffset(104)]
  15.             [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
  16.             public byte[] SET;
  17.  
  18.             [FieldOffset(107)]
  19.             [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
  20.             public byte[] ID;
But at that time I got the error as object field at offset 107 that is incorrectly aligned or overlapped by a non-object field..Can anyone tell me what is the main reason behind this..

Thanks..
Apr 22 '15 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.