I have a COM server. If i invoke its method in dynamic style like this, in case of some problem on the other side i get full exception
try
{
Type factoryType = Type.GetTypeFromProgID("VPI.TcHost.TcAppFactory");
dynamic factory = Activator.CreateInstance(factoryType);
dynamic appl = factory.CreateTcApp("Nga", "8.7");
}
catch (COMException ex)
{
//Here i get nice exception with _FULL_ description message
}
When i create InteropAssembly and call its method like this, in case of some problem on the other side i get i get short exception wrapper
try
{
CTcAppFactory appFactory = new CTcAppFactory();
CNgaApp mApp = appFactory.CreateTcApp("Nga", "8.7");
}
catch (COMException ex)
{
//Here i get short exception with hex code without Error string that was sent
//from COM server
}
This is how short exception looks like. (It contains no description for problem that my COM server sends)
How can i get full exception in strongly typed variant of code ?
DISP_E_EXCEPTION is a COM error that normally is only produced when you use the COM server late-bound. Like you did in the first snippet. It is odd that it appears in the early-bound version, but technically possible if the COM server itself is using late-binding on some other kind of COM server and just passes the error code through. The CLR interop layer is now however not going to easily get the EXCEPINFO from IDispatch::Invoke(). Unless the COM server properly implements IErrorInfo, seems like it doesn't.
Not much you can do about that, the author clearly seems to only support late bound calling well. Contact him for support or fall back to late bound.