Bug - ResolutionFailedException When Open Generic Type Defined In One Assembly Requested with Type Param (Defined As Internal) Is In a Different Assembly

Nov 18, 2009 at 5:00 PM

I know really long title but that's what Unity seems to be doing...

I've created an issue for this as well with a sample project showing how to reproduce the problem at http://unity.codeplex.com/WorkItem/View.aspx?WorkItemId=6303.

For some weird reason Unity chokes when an open generic type is defined in one assembly and the type param is defined in a different assembly and is an internal type. Unity doesn't seem to care when both the open generic type and the type param are in the same assembly even when the type is an internal type. The work around is to mark that type param as internal which is okay in my case, but I know if I was writing some sort of SDK that may not be okay specially if that type is supposed to be internal...

Figured I'd post it as a discussion since I know I never look at the issue tracker! :-)

Carlos

Feb 12, 2010 at 3:53 PM

Thanks!  I was recieving this error and your message jogged my memory.  I tried using <Assembly: InternalsVisibleTo("Microsoft.Practices.Unity")>, but that didn't resolve it either.  I had to change my type to Public.