vstest icon indicating copy to clipboard operation
vstest copied to clipboard

.NET 4.5 XUnit project using Newtonsoft.Json with incorrect binding redirect doesn't work with TPv2

Open halverson-dev opened this issue 9 years ago • 3 comments

Description

I have a project ( \\scratch2\scratch\kevinh\XUnitTestProject.Desktop) that doesn't work with Live Unit Testing (tests time out during execution with no errors).

Steps to reproduce

Open above project Test > Live Unit Testing > Start

I'm not seeing this with an analogous MSTest project, so I'm guessing it has something to do with xunit.runner.visualstudio, but I can't figure out what it could be. AFAICT, nothing in xunit references Newtonsoft.Json, so I'm guessing it must have something to do with AppDomain creation or policy.

Expected behavior

Tests run and "failed" coverage glyphs appear

Actual behavior

Nothing happens for ~60 seconds and then "uncovered" coverage glyphs appear (because tests never execute)

Environment

Dev15.3 preview 1

halverson-dev avatar May 25 '17 16:05 halverson-dev

When running with TPv1 (Test Explorer), I get:

Test Name:	XUnitTestProject.TestClass1.Test1
Test FullName:	XUnitTestProject.TestClass1.Test1
Test Source:	C:\Users\kevinh\Documents\Visual Studio 2017\Projects\XUnitTestProject.Desktop\XUnitTestProject.Desktop\Class1.cs : line 11
Test Outcome:	Failed
Test Duration:	0:00:00.039

Result StackTrace:	
at XUnitTestProject.TestClass1.Test1()
----- Inner Stack Trace -----
Result Message:	
System.IO.FileLoadException : Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
---- System.IO.FileLoadException : Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

halverson-dev avatar May 25 '17 17:05 halverson-dev

@KevinH-MS : What is the target framework version of test project.

Can you try running your test with TPv2. You will get TPv2 here ( "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe")

If tests with TPv2 fails, then let us know the version of extension Microsoft Visual Studio Test Platform ( Tools -> Extensions and Updates -> Microsoft Visual Studio Test Platform)

It will be great if you can share repro project with us.

Faizan2304 avatar May 26 '17 05:05 Faizan2304

@Faizan2304 I have shared the repro project at \\scratch2\scratch\kevinh\XUnitTestProject.Desktop

halverson-dev avatar May 26 '17 06:05 halverson-dev