Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xUnit 2.3.0 VS Runner breaks Live Unit Testing feature of VS 2017 #1514

Closed
kstreith opened this issue Oct 13, 2017 · 10 comments
Closed

xUnit 2.3.0 VS Runner breaks Live Unit Testing feature of VS 2017 #1514

kstreith opened this issue Oct 13, 2017 · 10 comments

Comments

@kstreith
Copy link

kstreith commented Oct 13, 2017

Repo project here:
/~https://github.com/kstreith/xunit23liveunittestbug

If you use the xunit.runner.visualstudio 2.3.0 package, live unit testing is broken. Open the ConsoleApp1.sln in LiveTestsBrokenWith_xUnit23Vs23Runner in VS 2017. Enable live unit testing. It will fail with the following messages in the Output window (Live Unit Testing output).

[17:30:19.495 Info] Live Unit Testing started.
[17:30:22.483 Info] Build completed (succeeded).
[17:30:27.009 Info] Started executing 1 tests.
[17:30:28.862 Info] [TestRunner 1] [xUnit.net 00:00:00.3146146] UnitTestProject1: Catastrophic error during deserialization: System.ArgumentException: Could not load type 
Parameter name: serializedValue
   at Xunit.Sdk.SerializationHelper.Deserialize[T](String serializedValue)
   at Xunit.Sdk.TestFrameworkExecutor`1.Deserialize(String value)
   at Xunit.DefaultTestCaseBulkDeserializer.<BulkDeserialize>b__2_0(String serialization)
   at System.Linq.Enumerable.<>c__DisplayClass7_0`3.<CombineSelectors>b__0(TSource x)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Xunit.DefaultTestCaseBulkDeserializer.BulkDeserialize(List`1 serializations)
   at Xunit.Xunit2.BulkDeserialize(List`1 serializations)
   at Xunit.Runner.VisualStudio.VsTestRunner.RunTestsInAssembly(IRunContext runContext, IFrameworkHandle frameworkHandle, LoggerHelper logger, TestPlatformContext testPlatformContext, IMessageSinkWithTypes reporterMessageHandler, AssemblyRunInfo runInfo)

This is only an issue with the xunit.runner.visualstudio 2.3.0 package. If you look in the repo solution directory, I have another project. The LiveTestsWorksWith_xUnit23Vs22Runner project works correctly with Live Unit Tests, it has xunit 2.3.0 but uses the earlier version of the visualstudio runner, e.g. 2.2.0.

I used Visual Studio 15.3.3. Details on Live Unit Testing of Visual Studio: https://docs.microsoft.com/en-us/visualstudio/test/live-unit-testing

I'd like to be able to use the new visualstudio runner with live unit testing feature of VS.

@bradwilson
Copy link
Member

Xunit.DefaultTestCaseBulkDeserializer.BulkDeserialize

This is not a good sign. ☹️

@felipeOliveira
Copy link

I have same problem here =(

@smadala
Copy link

smadala commented Oct 17, 2017

To unblock yourself, Downgrade xunit packages to 2.3.0-beta5-* which may cause performance degrade.

@campersau
Copy link
Contributor

We have used xunit 2.2.0 but after the Windows Fall Creator Update 2017 yesterday we got the following error:

Catastrophic failure: System.TypeInitializationException: Der Typeninitialisierer für "Xunit.DiaSession" hat eine Ausnahme verursacht. ---> System.IO.FileNotFoundException: Die Datei oder Assembly "System.Reflection.TypeExtensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

So we updated to xunit 2.3.0 and there we had the same problem as described in the bug report.
Even though we don't do live unit tests but denying app domains.

Downgrading to xunit 2.3.0-beta5-* resolved all issues.

@paulomorgado
Copy link
Contributor

On the other hand, using the regular Visual Studio test runner yields the same error with xunit 2.3.0-beta5-build3769.

amaitland added a commit to cefsharp/CefSharp that referenced this issue Oct 25, 2017
…main, it's possible to use xunit for testing.

Readd CefSharp.Test.csproj to solution
Add some very basic unit tests using xunit, DisableTestParallelization, Set xunit.appDomain to denied in app.config to disable using appdomains (https://xunit.github.io/docs/configuring-with-xml.html)
Add xunit vs test running packages, using 2.2.0 version as 2.3.0 was throwing an exception similar to xunit/xunit#1514
TODO: Take a look at /~https://github.com/NuGet/NuGetGallery/tree/master/tests/NuGetGallery.Facts for some ideas on structuring xunit tests (look at implementing Theory)

NOTE: I am not providing this as a definitive set of tests, it's simply here to get someone else started in creating tests as it appears people have trouble dealing with AppDomain problem
Only includes Tests for the OffScreen version at this stage.
@majorimi
Copy link

I'm using xUnit 2.3.1, xunit.runner.visualstudio 2.3.1 with VS 2017 Enterprise 15.7.5
Live Unit testing still does not work...

@bradwilson
Copy link
Member

@majorimi Does it still repro with 2.4 RC 1?

@bradwilson
Copy link
Member

(if so, please open a new issue with a repro)

@majorimi
Copy link

Thanks for the reply @bradwilson. I'm not a big fan of using Pre-Release packages because they tend to break something. Since the feature is already broken I tried your suggestion. Even used a newer version than you suggested: 2.4.0-rc.2.build4045. Result is the same... Live unit testing does not work.

Looking into the Output window I just got a very weird error message:

[08:57:44.028 Info] Live Unit Testing started.
[08:57:45.001 Info] Build completed (failed).

But it is completely bogus. I can build, run, debug the project. So there is no build error. Additional info: my project is a Visual Studio Extension. Can it be the root cause of the issue?

@bradwilson
Copy link
Member

I will look at the other issue w/ the repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants