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
I understand what's going on here, but have 2 questions (stack trace below)

1. how to track down the origin, the stack trace isn't helpful determining what fake/object has the uninit. field ?
2. how to disable this "Verfiying". I didn't setup any expectations or strict checks on this object, I'd rather ignore this, as my test is fine and passes, but I can't have this exception throwing.

One of the background threads threw exception: TypeMock.VerifyException: 
TypeMock Verification: The call to System.Net.Sockets.NetworkStream.Finalize() was made on an uninitialized field.
at c9.a(Object A_0, String A_1, String A_2, MethodBase A_3, Object[] A_4, Object A_5)
   at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Object[] A_5)
   at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected)
   at System.Net.Sockets.NetworkStream.Finalize()
Test host process exited unexpectedly.


I am using a TcpListener and tried this to no avail.

TcpListener listener = Isolate.Fake.Instance<TcpListener>();
            Isolate.WhenCalled(() => listener.Server).WillReturn(Isolate.Fake.Instance<Socket>());


p.s. This is also causing my code coverage/mstest to blow up. :(

Thanks for the help.
asked by Rybolt (3k points)

3 Answers

0 votes
Hi,
I am trying to reproduce this issue here with no luck. Can you please post the rest of the code the test?

What version of Isolator are you using and which test runner are you using?

Regards,
Elisha,
Typemock Support
answered by Elisha (12k points)
0 votes
Hi,
I am trying to reproduce this issue here with no luck. Can you please post the rest of the code the test?


I am sorry I cannot post the code entirely. I think it is related to how the TcpListener is faked. I was going to pass in ctor args to the Fake.Instance method, but my workaround was to use an actual TcpListener object instead of the Fake.

What version of Isolator are you using and which test runner are you using?


at the end of my post, I mentioned MSTest as my test harness. it's easy to miss that line though :)
answered by Rybolt (3k points)
0 votes
Rybolt,

Is it possible for you to post the test code, rather than the production code? We normally can deduce the rest of the picture ourselves to recreate the issue. If you don't want to publicly post it, you can send an email with the relevant code to support at typemock.com.

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