“Bad class token” when running (N) unit tests with TypeMock

Had a strange problem today, some of the automated build tests were failing with "Bad class token". However, when I went onto the build machine and ran them via NUnit GUI they worked fine. The difference is that we’d normally run the tests via Type Mock to ensure all the mocks work correctly. When I ran NUnit GUI via TypeMock the tests would fail…well actually sometimes they’d work, sometimes they wouldn’t. Yes that’s a lovely position to be in <gulp>. The obvious cause to these problems was that I’d just upgraded Visual Studio 2008 to SP1. So I manually rebuilt the whole solution and everything seemed to spring back to life again. Odd problem but hopefully now someone else won’t have to sit around scratching their head like I had to!
I blogged too soon. Turns out I still have the problem, but only with automated builds, if I build by hand (on the build server) then everything runs fine…weird.

Turns out I "just" needed to upgrade TypeMock to the latest version.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s