Thank you all for spending your precious time to help me.
With the help of your answers and suggestions I resolved the problem.
What i did is..
Since the
[STAThread] is resposible for Initialization of COM Library
Removed the following functions from my
CheckLicense() in the
C++ dll
CoInitializeEx(0, COINIT_MULTITHREADED);
CoInitializeSecurity(
NULL,
-1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL );
CoUninitialize();
Now works fine.
Thanks a lot to @CPallini , @ChristianGraus , @wong-shao-voon , @KarstenK