by Njål

Visual Studio 2012 Fakes – ShimNotSupportedException when debugging tests



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):


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


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:

  • Pingback: Unit testing – Visual Studio 2012 Fakes in Team City | Degree Blogg()

  • smwikipedia

    same exception, but your solution doesn’t work. I have met many nasty VS2012 abnormal issues, it seems VS2012 is a half-baked product.

  • Patrick Tseng

    You can add a runSettings file which wraps your .testsettings files to run your test (ref. ). In the runSettings file (e.g My.RunSettings), specify the following


    This should allow your fake tests to be debugged under VS2012.
    Patrick Tseng MSFT

  • crazy0man

    Your solution works for me.
    But from my side, it doesn’t need to disable the InteliTrace.

    I can run test case successfully with VSTS test exporler.
    But failed to run test with resharper test tools.

  • Njål

    Running Fakes tests should work in Resharper 7.1 –


  • Andreas

    Deleting local.testsettings and .vsmdi worked for me.