Attempted to read or write protected memory. This is often an indication that other memory is corrup

Posted by Venu510 under C# on 1/27/2012 | Points: 10 | Views : 2376 | Status : [Member] | Replies : 0
Hi Frieds!

After a long time i am posting here.I recently shifted to windows application development team.I had one doubt , i need to use u25idautomation.dll method IDA_C128.But this dll in an un managed dll,so we can't do addreference.We have to call by using Platform Invoke process.I did the same but when the time of calling that method it its giving the following error.Here i am giving my code also.


Error:

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."


Code:

// This is a call to unmanaged code. Executing this method requires
// the UnmanagedCode security permission. Without this permission
// an attempt to call this method will throw a SecurityException:
[DllImport("U25IDAutomation.dll")]
private static extern string IDA_Code128(string DataToEncode);

iam calling this method in another method ..like

this.LabelContents.Add(new Tuple<string, string, Font, Font>("Barcode", IDA_Code128(txtPalletId.Text), valueFont, valueFont));

this is the line where am calling the method.I done google search but not got any solution can any one please ...



Thanks
-----

VENU.MOGURAM




Responses

(No response found.)

Login to post response