My windows application using user control and one dll is loaded on 4 pc. One of the pcs pop up , “Attempted to read/write protected memory”. Pls give me advise.
Windows form is just used as back ground. User control is loaded on this win form and add one dll in the reference.
I was getting the exact same message in an application, and it was very hard to get it solved. I have googled for that message and have found a number of different causes and solutions…. none of them worked for me.
Well, in my case, I was using a COM object in my .NET application…. and that error would appear randomly in different parts of the code. Eventually, after lot of time debbugging, I found that the following line was causing the error:
arr = doc.GetAllExternalReferences3(objOptions, objRefVar, objIsVirtual)objRef and objIsVirtual were byref parameters. I am not an Interop expert, but it seems that casting from the original types (in COM) to “object” in .NET was not working very well, specially when the scope of those objects finished. Anyway, I didn’t need those values and there was an overloaded method that didn’t need those parameters. So I was lucky and didn’t need to go deep into the COM interop details. Anyway, I learned that one has to be very carefull with what a COM objects return to .NET….
Not sure if this is the case for you. But perhaps this anwer can help anyone else googling for this message.