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
+1 vote

I have tests that run perfectly fine locally, but fail in the build (step 'Typemock via Visual Studio Test').

There's a little piece of code that is executed in the SUT that contains the method System.IO.File.ReadLines(String, Encoding).

However, the error message I get when running these tests in the build:

System.MissingMethodException: Method not found: 'System.Collections.Generic.IEnumerable`1<System.String> TypeMock.Interceptors.FileInterceptor.ReadLines(System.String, System.Text.Encoding)'.

It seems that it is looking for a ReadLines method in TypeMock.Interceptors.FileInterceptor instead of System.IO.File.

To be absolutely clear: I am not trying to mock this method! There isn't even a line of code in the solution that tries to mock this method (so let alone a line that could potentially be called). 

Can anybody explain this behaviour to me and, more importantly, tell me how to prevent this from happening?

asked by Ralph (660 points)

2 Answers

+2 votes
Best answer
Hey Ralph,

We have released a version update, there we fixed the issue you encountered.

You can download the latest version here:

Let me know if that helped.


answered by SapirTypemock (3.2k points)
selected by Ralph
+2 votes
Hey Raplh,

First of all, we check every call to a function, even if it was mocked or not.

It appears that the problem you encountered is a bug.

We are working on a patch for it, and I will update you as soon as it is ready for use.

Meanwhile, can you tell me where you run your tests?


answered by SapirTypemock (3.2k points)
Tests are run in the build in VSTFS2015 using the build step 'Typemock via Visual Studio Test'