B
batvanio
Hi,
Sorry I am bringing this topic again, but something does not feel
right:
I am trying to use VS 2005 unit test to prove that a COM component that
I use is throwing the right COM exception. So I am trying this
try
{
COMComponent.GenerateCOMException(); // this throws the COM
exception
}
catch (System.Runtime.InteropServices.COMException e)
{
// this should show the HRESULT of the COM exception....
MessageBox.Show(e.ErrorCode.ToString());
}
However, as soon as the exception is generated, the unit test fails and
does non even go to the catch statement - exits immediately. Funny
thing is that if I use a generic exception like catch (System.Exception
e), it DOES go to the catch statement. However, the generic exception
does not give me the ErrorCode, which is a member of COMException only.
If i try the ExpectedException attribute, as soon as it generates the
exception, it exits, again without reaching the catch statement, this
time with Passed result...
Does anyone have any idea what is going on....?
Thanks,
Ivan
Sorry I am bringing this topic again, but something does not feel
right:
I am trying to use VS 2005 unit test to prove that a COM component that
I use is throwing the right COM exception. So I am trying this
try
{
COMComponent.GenerateCOMException(); // this throws the COM
exception
}
catch (System.Runtime.InteropServices.COMException e)
{
// this should show the HRESULT of the COM exception....
MessageBox.Show(e.ErrorCode.ToString());
}
However, as soon as the exception is generated, the unit test fails and
does non even go to the catch statement - exits immediately. Funny
thing is that if I use a generic exception like catch (System.Exception
e), it DOES go to the catch statement. However, the generic exception
does not give me the ErrorCode, which is a member of COMException only.
If i try the ExpectedException attribute, as soon as it generates the
exception, it exits, again without reaching the catch statement, this
time with Passed result...
Does anyone have any idea what is going on....?
Thanks,
Ivan