C # attempts to read or write protected memory, which usually indicates that other memory is corrupted. The error type is: System.accessviolationexception.

Source: Internet
Author: User

C # attempts to read or write protected memory, which usually indicates that other memory is corrupted. Solution Solutions

The error DLL file should be written in C + +. Encapsulated and then called by my C # program, the result is an error: An attempt was made to read or write protected memory. This usually indicates that other memory is corrupted. The error type is: System.accessviolationexception.

Workaround when calling someone else's DLL in C #, there are times when attempts to read or write to protected memory occur. This usually indicates that other memory is corrupted.

It is better to use pointers when passing values, and then convert them in C #.


To forcibly release COM resources in your program, call the Marshal.ReleaseComObject () method to release objects that are no longer in use

C # attempts to read or write protected memory, which usually indicates that other memory is corrupted. The error type is: System.accessviolationexception.

Related Article

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.