Reputation: 857
I have a COM component. I registered it using regsvr32 on my 32-bit XP machine. Now when i try to instantiate a class from it in my CONSOLE application, the application just terminates, without giving any exception. Any suggestion??
The COM dll is ABCServer.dll. The code that fails,
try
{
ILookUp LP = new LookUp();
ABCServer Svr = LP.LookUpServer(hostname, port);
}
catch(Exception ex)
{
Console.WriteLine(ex.message);
}
Control never reaches line 2, while debugging when i click F10 when being on line 1, the application just terminates
Upvotes: 1
Views: 144
Reputation: 52107
The COM code probably calls the C/C++ abort()
for some reason (or whatever the equivalent is in the COM DLL's implementation language). And since the COM server is in-process, that immediately kills the whole process.
Note that C++ exceptions cannot pass through the COM boundary (they must be explicitly "marshaled" via ISupportErrorInfo
). If an exception was raised in the COM DLL but was not properly caught and handled by the COM DLL implementation code, this might have caused abort()
to be called.
If you have debug information for COM DLL, you can try enabling unmanaged code debugging (from Debug tab of project properties, or through "Select" button in the Attach to Process dialog) and stepping into the native COM code to try and diagnose the root problem.
Upvotes: 2