I've hit an issue that has stumped me. I have Specflow tests that run perfectly fine on my local machine, but fail when run in the build.
The error message I get is:
System.MissingMethodException: Method not found: 'System.Collections.Generic.IEnumerable`1<System.String> TypeMock.Interceptors.FileInterceptor.ReadLines(System.String, System.Text.Encoding)'.
The code where this originates from:
public class FileReader : IFileReader
{
public List<string> ReadLines(string fileFullPath)
{
return File.ReadLines(fileFullPath, Encoding.ASCII).ToList();
}
}
To me, it appears as if TypeMock is trying to mock the File.ReadLines()
method. However, there isn't a single line of code in the solution that requests this method to be mocked.
Does anybody have an idea what might be going on here? Why do I get that strange exception? And what is the cause of the difference between the outcome when the tests are run locally or in a build?