Thursday, February 09, 2006

Missing method? What missing method?

I just spend the best part of a day tracing down why my unit tests were throwing a 'MissingMethodException' with a description of exactly the menthod that was there. I recompiled, I rebooted, I did everything I could think of. It still didn't find the method. I wrote a simpler test. No good. I ended up with a test that created an instance of the class and called a one line method that just returned a constant int. Still no good.

I explored the assembly that was being created when I compiled with Reflector. Everything was there. All in place. So the assembly was created ok.
So..the hunt was on. What assembly is NUnit picking up?

Eventually.. through the use of fuslogvw.exe and this helpful advice I eventually found it was loading from 'C:\Documents and Settings\nigel\Local Settings\Application Data\assembly\...someplace'. I tried to delete this directory, and couldn't because devenv.exe was using it. So it turns out Dev Studio was helpfully holding onto an old version of an assembly I was working on in a place that .Net checks BEFORE it checks the directory the test assembly was in. How rediculious!

I killed closed dev studio. I killed the devenv process that just kept hanging around even though devstudio was no longer running (nice) and then deleted the '...Application Data\assembly' directory.

This time I run the tests and Ping! lovely green lights.

I mention this so maybe it will save you the 1/2 day it cost me. :)



Post a Comment

GitHub Projects