ivanadu
asked on
Strong name for unsafe C++ assembly (dll) to be calles by C# application
Hello, I am trying to import (Dll import) into a C# application, a C++ dll, wrapping a third party USB driver API. Everything runs smoothly but sometimes the application consumes even up to 99% of cpu. By running process check up, I have discovered that from time to time (at moments of high cpu load) an invisible exception occurs, at the dll level related to the StrongNameErrorInfo. Next to that exceptions related to unregisterassembly and other similar issues.
Well started searching for Strong, Weak name signing assembly and found nothins related to this situation.
Does anyone have a solution?
Thanks.
Well started searching for Strong, Weak name signing assembly and found nothins related to this situation.
Does anyone have a solution?
Thanks.
ASKER
I'll give it a try. I am back within an hour :)
ASKER
ntdll.dll!KiFastSystemCall Ret
FTD2XX.dll!FT_IoCtl+0x56
mscorwks.dll+0x1b4c
mscorwks.dll!DllUnregister ServerInte rnal+0x61a d
mscorwks.dll!StrongNameErr orInfo+0x5 3ee
mscorwks.dll!StrongNameErr orInfo+0x5 5a6
mscorwks.dll!StrongNameErr orInfo+0x5 6ca
MyDll.dll!MyThreadFunction +0x83
KERNEL32.dll!BaseThreadIni tThunk+0x1 2
ntdll.dll!RtlInitializeExc eptionChai n+0x63
ntdll.dll!RtlInitializeExc eptionChai n+0x36
ptr is a reference to a function from the c# application passed at init time.
Most of the times this works, and when the communication load is high it fails.
FTD2XX.dll!FT_IoCtl+0x56
mscorwks.dll+0x1b4c
mscorwks.dll!DllUnregister
mscorwks.dll!StrongNameErr
mscorwks.dll!StrongNameErr
mscorwks.dll!StrongNameErr
MyDll.dll!MyThreadFunction
KERNEL32.dll!BaseThreadIni
ntdll.dll!RtlInitializeExc
ntdll.dll!RtlInitializeExc
ptr is a reference to a function from the c# application passed at init time.
Most of the times this works, and when the communication load is high it fails.
typedef void (__stdcall *pTempMessageHandler)(unsigned long);
unsigned long bytes2Read;
unsigned long bytes2Send;
unsigned long eventStatus;
pTempMessageHandler ptr = (pTempMessageHandler)pContext;
while (applicationRun == true)
{
unsigned int uiTemp = WaitForSingleObject(hEvent,INFINITE);
try
{
if (applicationRun == true)
{ //(handle, *dword, *dword, *dword);
FT_STATUS ft_status = FT_GetStatus(ftHandle,&bytes2Read,&bytes2Send,&eventStatus);
(ptr)(eventStatus);
}
}
catch (char * str)
{
//cout << "Exception raised: " << str << '\n';
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
glad you found it. I was just thinking of a way to help you further, but it isn't easy with this type of errors if you're not behind the machine (physically or remotely).
ASKER
i know, once you search for such an error, you wonder if that is the right path. simplifying was the only option and minimizing interaction between c# and c++...
still not sure about this manually reset event, but once in correct position before reading how many bytes are in the queue i do not expect problems
thanks again
still not sure about this manually reset event, but once in correct position before reading how many bytes are in the queue i do not expect problems
thanks again
it seems likely that the error either occurs in your wrapper, or in the third party usb driver. Maybe you can add structured exc. handling in your wrapper (if not already there) to at least log any exceptions that occur from the driver?