I am calling winscard.dll methods from C# and everything has been working fine in a debug mode. Problem i am getting is in release mode
My call to establish context is
[DllImport("winscard.dll")]
public static extern int SCardEstablishContext(int dwScope, int pvReserved1, int pvReserved2, ref int phContext);
In my test app when I call this the pntContext variable appears to get set properly in debug mode. But, in release mode its not getting set. But strangely enough the return code is still 0 (success).
So, I'm just wondering what are the circumstances that could cause this, or what other things could I be doing wrong?
P.S. Also one thing i check is compilation platform is set to Any CPU. I were trying with changing platform and it get worked when I have x86 as platform and release mode. Such a odd behavior that why it then worked in debug mode?