Generic classes and Component services

Posted on Thursday, July 30, 2009 by Nicki

I recently wrote a lightweight generic data access layer with generic list functionality. Everything worked fine until I had to implement a derived class as a Serviced Component. Turns out classes with generic methods cannot be added to component services, regsvcs.exe gives the following error


An unknown exception occurred during installation:
1: System.Reflection.ReflectionTypeLoadException - Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.


Searched Google, and found 2 hits. If that happens you know trouble is looming on the horizon...

It appears to be a known bug, see the details here.

So for now I had to implement a workaround by not having my class derive from the generic base class but instead to have a private instance of it.

0 Responses to "Generic classes and Component services":