Data prototypes
[StructLayout (layoutkind.sequential, CharSet = charset.ansi, Pack = 1)]
public struct ACCOUNTMSG
{
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 21)]
Public byte[] Name; /*w Name * *
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 2)]
Public byte[] Sexno; /*w Sex * *
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 19)]
Public byte[] Deptcode; /* Department Code */
[MarshalAs (UNMANAGEDTYPE.U4)]
public UINT Cardno; /* Card number */
[MarshalAs (UNMANAGEDTYPE.U4)]
public UINT Accountno; /* Account Number * *
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 21)]
Public byte[] Studentcode; /*W Number * *
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 26)]//If the length is changed to 21 sometimes an error is thrown to throw an exception of type "System.ExecutionEngineException".
Public byte[] Idcard; /*W ID Number * *
Sometimes error, sometimes not error, is because byte[] initially returns the value can be differentiated, when the first byte cannot be filled, the back of the byte ""
Can not be filled. So if it is the last byte "" can be returned if the data is not long enough, but it is followed by a byte "", the data bit is not complete.
Therefore, an unpredictable error is raised.
Transfer from http://blog.csdn.net/jacky_zh/article/details/8530281
Go to throw exception with type ' System.ExecutionEngineException '.