Since some days all my C# unit tests in Visual Studio running on my local machine are raising following TypeInitializationException when reaching the first Shouldly statement:
The type initializer for 'Shouldly.ShouldlyConfiguration' threw an exception
with the inner exception
Illegal characters in path
And a stack trace:
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.Combine(String path1, String path2)
at Shouldly.Configuration.DiffTool.<>c__DisplayClass10_0.<GetFullPath>b__2(String path)
at System.Linq.Enumerable.<>c__DisplayClass7_0`3.<CombineSelectors>b__0(TSource x)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Shouldly.Configuration.DiffTool.GetFullPath(String fileName)
at Shouldly.Configuration.DiffTool.Discover(String path)
at Shouldly.Configuration.DiffTool..ctor(String name, String path, ArgumentGenerator argGenerator)
at Shouldly.Configuration.KnownDiffTools..ctor()
at Shouldly.Configuration.KnownDiffTools..cctor()
There is a similar issue on https://github.com/shouldly/shouldly/issues/422 but my PATH Environment is correct.
I get the same error for any Unit Test Project Independent of the path.
Even for the simplest test as
[TestClass]
public class UnitTest2
{
[TestMethod]
public void TestMethod1()
{
int i = 1;
i.ShouldBe(1);
}
}
On other machines I cannot reproduce the issue for the same tests.