D
Dmitry
Hi,
I have defined interface for COM components which inludes an argument being
filled with additional error info, if such occurs. If inside I raise COM
Error, I populate that parameter.
In COM environment this architecture works beautifully -- caller application
gets negative HRESULT and error description from IErrorInfo object, and
additional "log" information from that "ref" parameter:
In .Net it just never returns that paramter populated!
Can any one help?
COM IDL declaration:
HRESULT MyFunction([in] LONG lngA, [in] LONG lngB, [in, out] BSTR
*bstrLog)
In C++ Code:
.....
// error happened --> raise COM Error, fill log
*bstrLog = SysAllocString("something bad happened");
IErrorInfo *pErr ........ //code to raise error.
.....
In .Net
MyLib.MyClass objFunc = new MyLib.MyClass()
string strLog = "";
try
{
objFunc.MyFunction(12, 34, ref strLog);
}
catch(System.Runtime.InteropServices.COMException ex)
{
string strErrMesg = ex.Message;
long hr = ex.ErrorCode;
MessageBox.Show(strLog); // <<==== always empty --- seems .Net looses
information.
}
Thanks
Dmitry
I have defined interface for COM components which inludes an argument being
filled with additional error info, if such occurs. If inside I raise COM
Error, I populate that parameter.
In COM environment this architecture works beautifully -- caller application
gets negative HRESULT and error description from IErrorInfo object, and
additional "log" information from that "ref" parameter:
In .Net it just never returns that paramter populated!
Can any one help?
COM IDL declaration:
HRESULT MyFunction([in] LONG lngA, [in] LONG lngB, [in, out] BSTR
*bstrLog)
In C++ Code:
.....
// error happened --> raise COM Error, fill log
*bstrLog = SysAllocString("something bad happened");
IErrorInfo *pErr ........ //code to raise error.
.....
In .Net
MyLib.MyClass objFunc = new MyLib.MyClass()
string strLog = "";
try
{
objFunc.MyFunction(12, 34, ref strLog);
}
catch(System.Runtime.InteropServices.COMException ex)
{
string strErrMesg = ex.Message;
long hr = ex.ErrorCode;
MessageBox.Show(strLog); // <<==== always empty --- seems .Net looses
information.
}
Thanks
Dmitry