Daily Usage Issues

Missing method exception

Started by MattK on 6,628 views

Myself an a colleague of mine have both had an issue with tests giving a "missing method exception" after some refactoring. I saw it when i moved a method from an abstract class to a concrete class that inherited from the abstract class.
We are running ncrunch 2.4.0.2 on visual studio 2013.
I resolved the issue on my machine by disabling and then enabling ncrunch (forcing ncrunch to do a fresh build?). My colleague solved his by restarting his visual studio.
Hi, thanks for sharing this issue.

The cause of this is when NCrunch doesn't realise that a particular change you have made requires a depending project to be rebuilt. In theory, moving a method between types shouldn't be able to do this. Is it something you're able to reproduce? Was it done using an automated refactoring?

Cheers,

Remco
Hi Remco. I think i did the refactoring manually, and it also involved moving the same method from 1 interface to another. I do have ReSharper 8 installed so it's possible i used that but in this case i don't think i did. The classes i moved the method between were in project A, the method only calls 1 other method on an interface in project B, and the tests were in project C if that helps.
When it happens again i will hopefully be able to give more details. Is there anyway i can get you more information if it does?

Cheers,

Matt
Also, the code in the tests didn't change as the test was calling a concrete class and the method i moved was from the abstract class it was inheriting from.
Thanks Matt. I've just done some experimentation but couldn't get this to happen for me. If you can manage to reproduce it consistently, do let me know how :)

Cheers,

Remco
Hi Remco,

I posted the above a month ago. I haven't been able to reproduce it since then but i have had a similar issue today.
I was moving some files around in project A, placing them in new folders and changing the namespace. The test project that relates to them cannot build, i think because it is seeing the old namespaces. I get lots of errors like this:

ConnectionTests\ListeningHigherCarpConnectionTests.cs (23): The type or namespace name 'ConnectResponseStatus' could not be found (are you missing a using directive or an assembly reference?)

If i go into each of the files that has a problem and put in some whitespace, ncrunch detects a change to the file and the error stops showing.

It should be noted i was using resharper to change the namespaces on my classes. I am using version 2.5.0.12 of ncrunch.

Cheers,

Matt
Thanks Matt. I do think that this is a different side of the same problem.

My theory at the moment is that there is some kind of data race involved when doing certain refactoring actions. 99% of the time, everything is fine and nothing goes wrong.. but on occasion, the data is being represented to NCrunch in an incomplete state.

It's extremely difficult to track and resolve an issue such as this, as it's likely to be occurring beneath the synchronisation layer (i.e. in VS itself), and the inconsistency stops it from being pinned down.

There may be changes to the way NCrunch synchronises with code in future.. for now, if you see this happen, I recommend just going in and touching the source file that seems to be out of sync with the rest of the codebase. This will trigger the event that will make NCrunch refresh its knowledge of the file, and is a much faster way to solve the problem than a full engine reset.

Post a reply

Log in to reply.