Getting Access violation exception while calling unmanaged DLL

  • Thread starter Thread starter Mayuresh Prachand
  • Start date Start date
M

Mayuresh Prachand

Guest
Method declaration

[DllImport(NBSDLLPATH, CharSet = CharSet.Unicode, EntryPoint = "IC_PowerOn")]
public static extern int IC_PowerOn(int Cno, out uint nRx, out byte[] ATR);


Method calling

byte[] pbATR = new byte[512];
uint typedef = 40;
int ATRRes = IC_PowerOn(0, out typedef, out pbATR);

I am getting below exception while returning byte array.

System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Continue reading...
 
Back
Top