by Njål

Visual Studio 2012 Fakes – ShimNotSupportedException when debugging tests

 

image

When testing VS2012 Ultimate I tried to use the new Microsoft Fakes framework to mock a simple static method. Running the test went fine, but I kept getting a ShimNotSupportedException when debugging the test. 

After goggling and trying all kinds of stuff I finally managed to debug the test by following these steps:

  1. Deleted the local.testsettings file (both in VS and on disk)

  2. Deleted the <solution>.vsmdi file (both in VS and on disk)
  3. Made sure IntelliTrace had these settings (not sure if this mattered):

    image

  4. Restarted VS2012
  5. Made sure that no .testsettings file were selected here

    image

Debugging of tests now works fine!
(Running/debugging the tests from Resharper still does not work – but I can live with this.)

I tried to add a new .testsettings file (with CodeAnalysis and everything else disabled) – but this makes the ShimNotSupportedException reappear again.

Similar Fakes/ShimNotSupportedException/Debug issues have been reported to MS, so I hope they get this resolved soon.

———————————————————————————————————–

Another sad fact is that the Fakes framework is only available in the Ultimate edition of Visual Studio 2012 – which retails at over USD 13,000. This makes absolutely no sense at all. ALL developers should use unit testing as part of their tool belt – and isolating tests using a mocking framework plays a key role. Microsoft Moles could be used for free in the previous VS 2010 version – and it worked great. This is very disappointing.

Please vote for this issue here: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2919309-provide-microsoft-fakes-with-all-visual-studio-edi