chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
Per the subject, I'm testing some WCF-related code and trying to setup an exceptional case:

Isolate.SwapNextInstance<AutofacServiceHost>().With(autofacHost);
Isolate.WhenCalled(() => autofacHost.Open()).IgnoreCall();
Isolate.WhenCalled(() => autofacHost.Close()).WillThrow(new TimeoutException());


The code under test:

try
{
    serviceHost.Close();
}
catch (CommunicationObjectFaultedException)
{
}
catch (TimeoutException)
{
}


The exception is thrown, but if I step through it in the debugger the type of the exception object is System.MulticastDelegate, not System.TimeoutException. Very bizarre...

If you change the above isolation to simulate a CommunicationObjectFaultedException, everything works as expected.

Any thoughts?

Thanks,
Matt
asked by mattburton (640 points)

4 Answers

0 votes
Hi Matt,

This is indeed very strange. I'm going to run some local tests and get back to you soon.

Doron,
Typemock Support
answered by doron (17.2k points)
0 votes
Excellent - thanks!
answered by mattburton (640 points)
0 votes
Hi Matt,

I couldn't recreate the behavior you are seeing locally. I will follow up on this with you offline to receive some more info and get a better understanding of what's going on.

Thanks,
Doron
answered by doron (17.2k points)
0 votes
After following up with Matt it turns out the problem was a configuration problem at his side - there was a "using" directive that pointed to the wrong TimeOutException. After correcting this the problem went away.

Doron
answered by doron (17.2k points)
...