Throws an exception of type "System.ExecutionEngineException"

Source: Internet
Author: User
Tags function prototype microsoft help

This problem occurred yesterday when the function was debugged

Throws an exception of type "System.ExecutionEngineException".

The function prototype is:

public struct Cdmlastdispense
{
public byte Last_cmd; Command last Sent
public byte Last_error_cd; Error code last occurred
public byte LAST_CBX; Cassette Box Last operated
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 2)]
Public byte[] Last_dispense_count; Dispensed count
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 2)]
Public byte[] Last_divert_count; Diverted count
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 2)]
Public byte[] Last_pick_count; Pick Count
}

[DllImport ("FlCommCDM.dll", EntryPoint = "Flcommcdm_lastdispense", CharSet = CharSet.Ansi)]
public static extern int Flcommcdm_lastdispense (ref cdmlastdispense Lpresult);

The function was invoked, and debugging was successful at first. Suddenly the computer reacted slowly and died, then I forced the end of the program, and then started debugging the error. Turn into release

The runtime is waiting for an internal reaction.

Anyway, it was dead or alive. Start to check the anti-virus software is wrong, and then unloaded useless. It is also said that system. NET is compromised.

For this query \ Mscoree is the entry point for the managed program

reinstalled. net2.0. NET 2.0 is reinstalled with Windows clean up uninstall.

It's still not working.

It's still wrong.

Click after the program error:
An error has been encountered at run time. The address for this error is 0x791c7b88, on thread 0x1194. The error code is 0xc0000005. This error may be a bug in the CLR, or a bug in an unsafe or unverifiable part of the user's code. Common sources of this bug include user marshaling errors to Com-interop or PInvoke that could damage the stack
Throws an exception of type "System.ExecutionEngineException"

Finally found that the length of the byte[] statement is problematic, with the following change:

[MarshalAs (UnmanagedType.ByValArray, SizeConst = 6)]
Public byte[] Last_dispense_count; Dispensed count
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 6)]
Public byte[] Last_divert_count; Diverted count
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 6)]
Public byte[] Last_pick_count; Pick Count

has been solved, is caused by the length.

But why there is no error, always can be, because byte[] originally returned value can be distinguished, when the first byte can not be filled, the back of the byte ""

You can't fill it up. So if it's the last byte "", you can return the data length, but with byte "" On the back, the data bit is not all right.

Therefore, an unpredictable error is raised.


Process Harvest:. net2.0 installation is easy, unloading is difficult. Reinstall needs to be installed in Microsoft Help to remove files and registry using window clean up.



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.