28

I'm trying to debug my .NET Core xUnit tests in VS 2017 RC. I run my tests via the Test Explorer window. While right-clicking a test and selecting Run Selected Tests works fine, selecting Debug Selected Tests does not:

I'm at a loss at how to get past this. I have tried restarting VS, doing a clean build, removing the .vs/ folder, and even updating to a newer build of VS 2017. However, nothing so far has worked. Does anyone have suggestions for how I can work around this? Thanks!

edit: My project has a Git repo here, so if you want to you're free to clone it and see if you can repro for yourself. The test assembly is in src/BasicCompiler.Tests/.

James Ko
  • 32,215
  • 30
  • 128
  • 239
  • Is the `c#` tag necessary if you already use the `.net` tag in this context? – devRicher Dec 25 '16 at 21:07
  • 4
    @devRicher I think this question is related to both C# and .NET because the tests are failing over a C# project. – James Ko Dec 25 '16 at 21:21
  • Compare to my project https://github.com/lextm/sharpsnmplib/blob/9392c72021be63b17866351ab5093492fdb51365/Tests/Tests.NetStandard.csproj I can only see the version of xunit is not up-to-date. – Lex Li Dec 31 '16 at 14:11
  • 1
    Did you try to create new project and write test to make sure that it is not your project setting that causes the issue? – Denis Palnitsky Mar 06 '17 at 21:02
  • 1
    http://stackoverflow.com/questions/2375869/visual-studio-crashes-when-i-debug-a-project-with-a-certain-form-open-in-design Not sure if this guy's answer will help, but I hope it does. The error code is "catastrophic failure", which is super generic. Try also unloading and reloading the project? – Rachael Dawn Mar 06 '17 at 21:47
  • 2
    Use the "Report a Problem feature: found under the Help -> Send Feedback. I've gotten responses from the Visual Studio team previously that have helped (by providing my email with the report). – Adrian Sanguineti Mar 09 '17 at 00:53
  • 1
    I would monitor the memory consumption while debugging – FortyTwo Jun 06 '17 at 22:32

5 Answers5

7

In my case with Visual Studio 2017 release version the unit test project failed with this error because for some reason the unit test project had a launchsettings.json file under the project "properties" folder. Deleting it resolved the debugging issue.

Joe G
  • 99
  • 2
  • 3
1

Try running Visual Studio as an administrator, it might resolve the issue.

In case you don't know how: Right click on the application icon, right click on the applications name and select Run as Administrator.

0

If nothing helps try complete uninstall and reinstall of Visual Studio. Errors in upgrades cause issue sometimes. Ideally IDE should prompt errors and ask you to fix them but I have noticed Visual Studio does not do that; even when you go to updater and reinstall them.

Morse
  • 8,258
  • 7
  • 39
  • 64
0

I fixed this by updating Visual Studio 2017 to 15.9.6

Tools -> Extensions and Updates -> Updates.

MDave
  • 1,245
  • 13
  • 29
0

Restarting vs worked for me...

Qwerty
  • 578
  • 1
  • 5
  • 31