Sometimes it works, sometimes not

This is not good!
If something in your software is dependent from the combination of

  1. current weather in London (weather there changes very often, and you and your system actually sits in Sydney)
  2. the mood of your girlfriend (or wife) this morning and
  3. amount of nuts in your muesli in your breakfast bowl

you have a big problem


I can’t run tests anymore with MsTest
“Sometimes I can”
... and I am not sure if this is the fault of the latest TFS KB Update... Since we moved to TFS2010 we had to install this KB to work with VS2008 an TFS2010

When I try to run my tests I get this error


Same problem as Gabriel had described in his post about Error: "Exception has been thrown by the target of an invocation."
His solution: none. Over time it was fine :-)

To reproduce this I can easily do

  1. Start VS2008
  2. Go to “Test” | “Windows” | “Test Results”
  3. Error message!


I had a couple of things installed like: Resharper, Testdriven.Net, Coderush, … and was not sure what it is…
The last thing I installed was the KB article about using VS2008 with TFS2010.

What I did and didn’t help:

  • Start up Visual Studio in safe mode (parameter /SafeMode )
  • Start up Visual Studio and reset user data (parameter /resetuserdata )

Note: I hate to do a /resetuserdata because it looses all my “nice” settings like:

  • Removing animations and speedup start of VS
  • Changing F1 keyboard key to do NOTHING (That’s a big one!) ( -> Tools -> Options –> Environment –> Keyboard –> F1 “Remove” )
  • Track Active Item in Solution Explorer ( -> Tools -> Options -> Projects and Solutions  )

More of this settings can be found on stackoverflow Visual Studio optimizations


After all that, I attached another VS to the other one running with “Debug” –> “Attach to process” and enabling all exceptions in “Debug” –> “Exceptions”

Note: I saw a lot of Resharper exceptions once I start to open a solution and browsing through files…
exceptions in VSActionManager.cs, VSProjectInfo.cs, VSSolutionManager.cs, …

BUT NO EXCEPTION when I tried to reproduce the problem!
Figure: The top VS2008 is attached to the lower one (that reproduces the error).

Fix: None so far
but I was able to run the tests (and to see my “Test results” window) sometimes.

I think it must be a weird combination of “devenv /safemode”, “Open solution”, “Build”, “Clean”, “Rebuild”, “Cross fingers”, “Run all tests”… Or maybe the other combination mentioned at the top of the post.
Didn’t figure it out yet

Will update this post once I know!

Latest Posts

Popular Posts