views:

18

answers:

1

Hi All,

I am getting following error
System.accessviolationexception Attempted to read or write protected memory. This is often an indication that other memory is corrupt. 

when accessing a method of external dll.

I have used this dll many other projects which also uses .net 3.5. This external dll uses method from another dll. All this worked fine prior to this project. Am not sure what causing this. I have searched a lot and tried many solutions that people suggested but to no avail. If I use directly the second dll, i.e. the one that is called from the dll it worked fine, but I can't do that, as I need to use this one and not directly the second one.

Your help will be highly appreciated. Regards Kdj

A: 

First of All, your question does not contain exact details regarding WHEN error occurs.

When accessing a Method from External DLL, I faced the same problem. This can be solved by Pinning passed parameters. Sometime GC will relocate them and it will cause above error.

Try to Pin down!

Swanand Purankar