Rhino Mocks 2.6.6: Bug Fix Relase - StackOverFlow when overriding Equals
Okay, I got a bug report today about something I knew I fixed. A StackOverFlow exception when overriding Equals(). Looking at the code, I did fix it, for 1.1 (this is one of the few places where there is a difference between the versions, unfortantely).
More unfortantely, I didn't have a test for this, and I'm not sure why. IIRC, I got those exceptions by the dozens when I got this error, so I never bothered to write a spesific test for it. In hindsight, those exceptions where for Object.Equals(), which is not the same thing as the overriden method.
Looking at the code, it's a true shame that I didn't have a test for this, because it appears that I regressed with this scenario all over the place. I'm not sure how I can avoid this short of adding a couple dozens of tests that check all the code paths. So far I think that I got all of them. And I think that I'll be much more careful with this in the future.
The problem is that the code that caused the problem looked like those two samples:
- if(proxy == invocation.Proxy)//explode with fireworks
- IMockedObject mock = proxies[proxy];//explode with fireworks as well
I'm really concerned about regressing with this one, since I'm not in the mood to add couple of dozens of tests, and I'm not sure how to handle this one. Anyway, I got a test for the main path, of course, which should catch most new things that I do.
You can get the sources and binaries from this page.
Comments
Comment preview