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
Welcome to Typemock Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!
0 votes
This line of code:
      Isolate.Swap             .NextInstance<FileStream>().With(Isolate.Fake.Instance<FileStream>());


Will throw this exception:
failed: TypeMock.TypeMockException : 
*** In order to perform swapping the call to NextInstance<T>() must be completed by a call to With()
   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)


But I think it should return a cannot fake from mscorlib exception, not the cannot swap exception.
asked by (59.1k points)

2 Answers

0 votes
Soon Hui,

You're correct - this is a bug. The error message should have indicated this is an attempt to swap an mscorlib type, instead of the message you received.

Thanks,
Doron
Typemock Support
answered by (16.5k points)
0 votes
This issue was fixed in Typemock Isolator 5.3.4
answered by (11.9k points)
...