-
Notifications
You must be signed in to change notification settings - Fork 335
Unable to run/debug XUnit tests targeting Desktop from Visual Studio on latest Windows 10 machine #811
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I can see that tpv2 is enabled, and
Is there any other workarounds? |
@jeremymeng thanks for detailed investigation. Looks like reflection on OM.DiaSession is failing in adapter, need to debug to find what's going on. |
@jeremymeng : I tried to create local repro but no luck. I have windows 10 with Creator update (OS build 15063.296). I installed .NET framework 4.7. I too don't see Do you have repro machine where I can debug the issue? If not can you please try to provide us crash dump. To get the dump, attach vstest.executionengine.x86.exe (or vstest.console.exe if you are using TPv2 by enabling it through testplatform.config) and enable first chance exception. When it throws above mentioned exception save the dump. |
@Faizan2304 I attache a debugger to Visual Stduio, and got a dump when Call stack
|
Workaround:
|
I'm getting this today as well. @codito 's workaround didn't work for me :( edit-1: I happened to re-install the latest 2017 preview and it's working again 🤷♂️ |
Not sure if it's the same for 2.2.0, but for 2.3.0-beta3-build3705 i also commented out this section of <!-- <None Include="$(MSBuildThisFileDirectory)xunit.runner.visualstudio.dotnetcore.testadapter.dll"> -->
<!-- <Link>xunit.runner.visualstudio.dotnetcore.testadapter.dll</Link> -->
<!-- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> -->
<!-- <Visible>False</Visible> -->
<!-- </None> --> |
Seeing this on non-SDK csproj too. The workaround works, but to packages folder in the source tree. |
Created xunit/xunit#1348 and PR xunit/xunit#1349 in an attempt to fix this. This allows users on older versions of VS to be unblocked. We need to fix the adapter lookup logic in vstest too. Please see this RFC for details on vstest changes. It will likely get implemented post 15.3 release. |
Moved to 15.5 to track closure for this issue. |
We have merged the change, though it's currently untested (I don't have a machine with .NET 4.7 on it at the moment). A merged version that can be verified is available as of version |
@bradwilson |
|
Closing the issue since we have confirmation that the fix works :) |
FYI, that this fixed OmniSharp's tests in VS 2017 as well. |
|
I could like to add that in addition to the steps @codito mentioned above I also had to delete my packages folder in my solution and rebuild. |
Seems like this bug shows in v15.4.1 of Visual Studio for xUnit v2.2.0 with .NET 4.6.2 on Windows 10 Creators October 2017. Workaround by @codito works, update to xUnit v2.3.0 also seems to work. Unfortunately update to xUnit v.2.3.0 changes the behavior of the following code and breaks many tests with
UPDATE#1 UPDATE#2 Seems like in VS 15.4 and after, they added the dotNetCore tests adapter as part of Test Explorer and this conflicts with both test adapters for the same solution. |
I'm able to run my tests normally, but when attempting to profile them I'm encountering the "unable to load I have:
My test project targets Any ideas? |
Due to an xUnit bug, tests would attempt to run, but then fail immediately. Updating the packages fixes the issue. microsoft/vstest#811
Due to an xUnit bug, tests would attempt to run, but then fail immediately. Updating the packages fixes the issue. microsoft/vstest#811
Due to an xUnit bug, tests would attempt to run, but then fail immediately. Updating the packages fixes the issue. microsoft/vstest#811
After trying all of the above workarounds and still encountering problems, I deleted leftover app.config files (which had binding redirects in them). Problem solved. |
I tried some of the solutions above as well and no luck |
@jamesrcounts, is there any way you could indicate which was that leftover app.config that was causing the issue? |
Consolidating xUnit related nuget depdendencies and upconverting xUnit.analyzers did the trick for me. |
Why this is closed, the issue still persists |
Still facing the issue, none of your solutions above are actually solutions, those are just workarounds! |
Gentlemen, make sure to update your unit tests runner tools dependencies
and such dependencies alike. In my case updating all xunit dependencies and
consolidating their versions did the trick.
…On Thu, 15 Feb 2018 at 09:27, AlokArora ***@***.***> wrote:
Still facing the issue, none of your solutions above are actually
solutions, they are just workarounds!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#811 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAQ11ceGXklkhIJbsK7VCXDZ52SCVUdhks5tU_iNgaJpZM4Nbt0m>
.
|
For me when i upgraded to 4.7 framework, updating the dependencies to target net47 worked instead of net45. |
@ninjaboy could you be more specific on what this means and how to do it? |
https://stackoverflow.com/questions/43065518/how-to-consolidate-all-applicable-projects-and-nuget-packages-from-the-command-l
https://www.google.co.uk/amp/s/artczernecki.wordpress.com/2015/09/08/consolidating-package-versions-with-visual-studio-2015-nuget-package-manager/amp/
…On Fri, 2 Mar 2018 at 20:03, David Prothero ***@***.***> wrote:
Gentlemen, make sure to update your unit tests runner tools dependencies
and such dependencies alike. In my case updating all xunit dependencies and
consolidating their versions did the trick.
@ninjaboy <https://github.com/ninjaboy> could you be more specific on
what this means and how to do it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#811 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAQ11aR3Ly5_UMjmUslR1DxeIEvw4SiFks5taXs4gaJpZM4Nbt0m>
.
|
…icrosoft/vstest#811). Removed HtmlAgilityPack (HAP) from the MalApi project. Added HAP to the integration and unit test projects. Moved update test logic to the integration test project. Doubled the scraping methods in the unit test project to keep the scraping method tests and updated the readme.txt in integration test project to include a warning/notification. Added test for non-existant MAL entry. Updating id that is not on your list does nothing but still returns "Updated" response.
Try deleting your I also updated my XUnit packages first, but it did not want to work until I did this as well. |
Restarting Visual Studio after deleting |
This problem is not platform dependent . It appears also for other kinds tester nugets. Also for Microsoft's ; |
Due to an xUnit bug, tests would attempt to run, but then fail immediately. Updating the packages fixes the issue. microsoft/vstest#811
Due to an xUnit bug, tests would attempt to run, but then fail immediately. Updating the packages fixes the issue. microsoft/vstest#811
Due to an xUnit bug, tests would attempt to run, but then fail immediately. Updating the packages fixes the issue. microsoft/vstest#811
Description
After the Windows 10 Creators update, I can no longer run or debug xunit tests
targeting Desktop .NET Framework in Visual Studio.
Steps to reproduce
On a machine with .NET 4.7 and VS 2017 15.2. I think .NET 4.7 comes with
Windows Creators update. After I installed .NET 4.7 on another machine that had .NET 4.6, I
don't see
System.Runtime, Version=4.1.0.0
in GAC. The version4.0.0.0 is in GAC.
Create an xunit test project with
dotnet new xunit
.In the generated .csproj file, change the target framework to
net46
. Also change the package reference versions.Expected:
No warnings or errors
Actual:
there's a warning
Expected:
Test runs and passes.
Actual:
Environment
Operating system: Windows 10: a Microsoft internal selfhost version)
vstest.executionengine.x86.exe: 15.00.26228.0
My findings
I am using the SDK-style .csproj to target net46. According to the doc,
Desktop, UWP & Native unit testing continues to use the test platform (TPv1) located @ "%programfiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow"..
(I have briefly tried the method of putting a
testplatform.config
mentionedat the same link but it didn't work for me.)
I have .NET 4.7 on my repro machine. I suspect that
System.Runtime, Version=4.1.0.0
is in the GAC for latest windows builds.When discovering/executing unit tests, VS tries to get additional test
extensions from both xunit assemblies in the following order
%TEMP%\VisualStudioTestExplorerExtensions\2.2.0\build\netcoreapp1.0\xunit.runner.visualstudio.dotnetcore.testadapter.dll
%Temp%\VisualStudioTestExplorerExtensions\2.2.0\build\_common\xunit.runner.visualstudio.testadapter.dll
Because of the GAC version of
System.Runtime.dll, Version=4.1.0.0
, xunittest extension from the first assembly (.NET Core version) is successfully
added.
The test extension from the second assembly (Desktop version) is also added.
Now VS test platform has two test adapters for
executor://xunit/VsTestRunner2
When I rebuild the solution, the VS Test discovery engine uses the first one
(.NET Core version) and failed to load its dependency
Microsoft.Extensions.DependencyModel, Version=1.1.0.0
because my test istargeting net46.
Note, I am not clear why this dependency didn't cause problem when VS tries to
get types via reflection from assembly
xunit.runner.visualstudio.dotnetcore.testadapter.dll
.It seems still able to find the test (using the second xunit test adapter?)
When I run a test from VS Test Explorer, it failed.
On my non-reproing machine that have .NET 4.6. VS also tries to get test
extensions from the same two xunit assemblies. But getting types via
reflection fails for the .NET Core version because of the missing dependency
on
System.Runtime, Version=4.1.0.0
. TheReflectionTypeLoadException
ishandled. Thus only the Desktop version of xunit test adapter is added to the
list of test discoverers.
The text was updated successfully, but these errors were encountered: