Murphy's Revenge

time to read 1 min | 184 words

I was just preparing a big surprise to celebrate the release of Rhino Mocks 3.0 (expected very soon), when I run into a critical bug in the handling of non generic types inheriting from generic types, basically:

public interface IUserRepository : IRepository<User, string> {} 

The above can't be mocked. And nothing caught it until I was doing some "let us show the new stuff" preparations. As an aside, 85% of the bugs in Rhino Mocks at the moment can be traced directly to generics support. (10% are related to custom attributes support and another 5% is new features that aren't playing well with the rest of the system).

Generics look so nice on the surface, until you get deep into them. I have found a whole new world of appreciation to the compiler teams and the CLR to build such a leaks-proof abstraction over the required complexity.