Go to throw exception with type ' System.ExecutionEngineException '.

Source: Internet
Author: User

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 '.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.