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.