Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio - suddenly cannot debug tests

I'm not sure what I did, but all of a sudden, my Visual Studio 2012 will not debug any tests.

If I select a test from the Test Explorer and tell it to run, it simply outputs this in the Test Output window:

> ------ Discover test started ------ > ========== Discover test finished: 29 found (0:00:01.3371755) ========== > ------ Run test started ------ Process with an Id of -1 is not running. > ========== Run test finished: 0 run (0:00:01.4711861) ========== 

what the heck does that mean?! After doing this a few times, the error changed to:

The Operation was Cancelled 

which I sure didn't do.

It's doing this on every test in the list.

however, I can RUN the tests no problem, and they pass... but I cannot debug the tests.

What might I have done? I did not actively go into any settings and change anything, perhaps a stray click somewhere, but where?

like image 682
SelAromDotNet Avatar asked Aug 02 '13 18:08

SelAromDotNet


People also ask

How do you Debug test cases in Visual Studio?

Once you have your launch configuration set, start your debug session with F5. Alternatively, you can run your configuration through the Command Palette (Ctrl+Shift+P) by filtering on Debug: Select and Start Debugging or typing 'debug ' and selecting the configuration you want to debug.

How do I Debug SpecFlow tests in Visual Studio?

If the execution of a SpecFlow test is stopped at a certain point of the binding (e.g. because of an exception), you can navigate to the current step in the feature file from the “Call Stack” tool window in Visual Studio. By default, you cannot debug inside the generated . feature.


2 Answers

I encountered this today. I tried closing the solution but it didn't work. My mistake I set my solution to Release Mode instead of Debug Mode. I set it to Debug then it worked as expected.

I'm using VS 2015 professional.

like image 58
Tom Mabaquiao Avatar answered Sep 28 '22 10:09

Tom Mabaquiao


I was getting the same output after upgrading a test project from VS 2010 to VS 2012 Ultimate Update 3. The message was displayed in Test Output window after using MSTest command to Debug Selected Tests.

I tried to debug tests using Resharper 8 Unit Test Session window. The message in the result window was "Test wasn't run".

The solution that helped me was to modify the test project settings to enable native code debugging as instructed at this link: Uncaught exception thrown by method called through reflection

In case the link does not work:

  1. Go to the project right click and select properties.
  2. Select 'Debug' tab on the left.
  3. Go to ‘Enable Debuggers’ on the bottom
  4. Check ‘Enable Native code debugging’ (or 'Enable unmanaged code debugging', depends on version) check box

Thanks to GalDude33 for posting the solution.

like image 23
Branko Avatar answered Sep 28 '22 08:09

Branko