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!

Typemock trying to mock File.ReadLines in the buildstep 'Typemock via Visual Studio Test'

+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 6 days ago by Ralph (180 points)

2 Answers

+1 vote
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 2 days ago by SapirTypemock (730 points)
selected 2 days ago 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 3 days ago by SapirTypemock (730 points)
Tests are run in the build in VSTFS2015 using the build step 'Typemock via Visual Studio Test'