Being Cellfish

Stuff I wished I've found in some blog (and sometimes did)

ShimNotSupportedException when using ReSharper unit test runner

Change of Address
This blog has moved to

ShimNotSupportedException when using ReSharper unit test runner

  • Comments 1

I recently did some work using the VS 2012 RC together with R# 7. I needed to use the shim functionality from Fakes but ran into trouble. My unit test failed with a ShimNotSupportedException. After a little bit of searching I realized it was because I was using the R# unit test runner (since it's much faster and report failures in a much better way than the built in runner (if you ask me). Because if I ran the tests using the VS runner the tests passed. Annoying and I can only hope this is going to be resolved by jetBrains but meanwhile I'll be using the following work around:

  • I mark every test that uses Shims with the TestCategory attribute giving them a value like "UsingShims"
  • Then in my R# options for unit testing I fill in the same value in the box for "Don't run tests from category".

This way my tests using Shims are ignored by the R# unit test runner. You might think this is a bad idea and generally it is. However I use Shims rarely so there are relatively few tests that are ignored this way. So while working on things that do not require Shimming I can continue to use the fast R# test runner. And when I need to use Shims I just use the VS runner. Not perfect but a decent compromise for me in this case.

  • I've learned that the proper way to fix this is to add a RunSettings file. If one is missing a default one will be created with the wrong settings for this to work. Your RunSettings file should contan this:








Page 1 of 1 (1 items)