Test execution error in Visual Studio 2015 (worked in 2013) - visual-studio

We are in the process of upgrading from Visual Studio 2013 Update 5 to Visual Studio 2015 Update 1.
Our Solution has many tests and we use NUnit 2.6.4, along with the NUnit Test Adapter for NUnit 2.x.
When running these tests in Visual Studio 2013, they all run perfectly well.
However, when running in Visual Studio 2015 the first 200 odd tests run, then execution stops. I can then select the tests that have not yet run and successfully execute these. I have the latest ReSharper installed in both VS2013 and VS2015 and it happily executes all the tests.
We've been keeping test-coverage details for each release since the dawn of time, and from Visual Studio's test runner it shows me the number of blocks covered. But ReSharper shows us the number of statements covered. Slightly different values, but they'd mess up our charts.
When test execution fails, it creates a Dump file (it also creates some XML files that just seem to show what DLLs I've installed). I can open this and "debug" it, but it simply shows me a line of code that fails, and the call stack shows only [Managed Code], which means I can't identify the actual test that's causing the issue.
The fact that this works perfectly in VS2013 and in ReSharper running in VS2015 suggests that "it's not our fault", but whilst I'd like to think that, it doesn't help me fix this.
Any ideas?
Thanks
Griff

Tracked down the problem. We had one class in our Solution that implements IDispose and one of our Unit tests didn't dispose of that class, it just allowed it to go out of scope.
So because the Disposable object hadn't been disposed, the class' Finalizer hadn't been suppressed. The GC therefore called the Finalizer which in turn attempted to access another object that had also gone out of scope, resulting in an exception that crashed the Test Execution Runner.
Interesting that VS2015 running NUnit 2.x crashes, but the identical setup in VS2013 copes fine.
As an aside, when debugging the DUMP file (see above), I realized that the call stack was irrelevant, I just had to put in some defensive coding in the Finalizer.

Related

DEVENV Command line build fails with: "This operation may only take place in the UI thread"

we virtualized our build server and having issues building some c++ projects.
It is a win7 (we have some vb6 projects) with visual studio 2017.
When I build a project it just errors out with "This operation may only take place in the UI thread".
Also it is completely random...sometimes it compiles, sometimes it does not.
I have no idea why and what I could try to fix it. I have also a Win10 build machine where the problem does not happen. We want to stick with the Win7 build machine though, because on the Win10 one we got issues with some vb6 projects.
If I use msbuild it works fine, I would rather not replace all devenv calls for now though.
Anyone an idea what the issue could be or how to debug it?
Seems to be an issue with Visual Studio 2017 15.6.x. works fine with 15.5.7

VS2013 Resharper always runs all tests

I got this strange problem with VS2013, NUnit and resharper
When I try to run a single test it always runs all tests in the project. It doesn't matter if I select Run or Debug or if I start it from the editor, unit test explorer or unit test session.
Only the test I started show up in the Unit Test session. No results from the other tests is visible but break points are hit in all tests.
The problem seem to start at random after editing a test. Have tried clean rebuilds and restarting Visual Studio but the problem remain.
Restarting the computer helps but only until it starts again after some edit.
Using VS2013 update 5, Resharper 10.01 and Nunit 3.0.1 (also tried 2.6.4)
Is this a Visual Studio, NUnit or Resharper problem?
Only other strange thing I noticed is that CTRL-Q (R# show documentation) does not work within test methods. It always show documentation for the test method not the variable or class the cursor is on.

Visual Studio Unit Test: Huge startup delay in debug Mode

I'm working on a big code project. When I try to run a unit test in debug mode using nunit on Visual Studio 2013 Ultimate, there's a consistent 40 second delay before the test runs. Now, once the test starts running, it runs as fast as I'd expect. And if I run the test in Release mode, there's no delay.
I know it's a local environment problem because other developers report no similar delay when they fire up a test on the project.
I've been unable to determine what's causing this delay. The only visual evidence is that the cursor changes to a spinning cursor. I've disabled everything in Options that looked like it might be demanding. I have NCrunch and Resharper installed, but both are disabled, so neither appears to be at fault.
Any suggestions?

Resharper 6 simply ignores all my tests

I have a solution with a lot of nunit tests in different projects. When I run resharpers testrunner, it finds all the tests. But when it comes to execution it simply marks them all as grey and silently completes.
How do I figure out whats wrong with the testrunner, and most importantly how do I get it to run my tests.
I have resharper 6 in visual studio 2008. My code is on a fileshare, and everything runs in a virtual machine.
Jetbrains has confirmed this to be a bug. That resharper wont run nunit tests located on a networkshare. They'll try to fix it in 6.1.
You can find the ticket here:
http://youtrack.jetbrains.net/issue/RSRP-275538

Visual Studio 2010 expression evaluation in debugger gives "Cannot evaluate expression because debugging information has been optimized away"

When debugging unit tests in Visual Studio 2010 SP1 with NUnit 2.5.7 I often get this error evaluating an expression in the immediate window:
Cannot evaluate expression because debugging information has been optimized away
Often this happens when I test a few expressions and then all of a sudden I get this error. When the error occurs, the locals window empties out and the next attempt to step into a line effectively runs the code to the end--no more debugging.
I've seen something similar in ASP.NET related to the worker process not responding to ping requests since it was being debugged, but in my situation I'm running a local application, not a web application.
I'm running the tests through ReSharper 5.1.3. The code is all being built for for the "Debug" configuration against the .NET 4 framework.
This happens most of the time I run the debugger since upgrading from VS2008 to VS2010 yesterday.

Resources