Getting EntryPointNotFoundException in 1.1 that I did not get in 1.0

May 27, 2008 at 10:23 PM
We wrote a wrapper around the IUnityContainer that uses a Factory pattern to return an instance of the UnityContainer. 

The wrapper allows you to designate delegates to use to "wire up" the container (i.e. register instances, type mappings etc.)

In Unity 1.0 this worked fine.  The code creates an instance of the UnityContainer, then if any delegates have been assigned to the Factory, they are called, passing in a reference to the newly created UnityContainer. 

When I started playing with EntLib 4.0 today, I upgraded our references to the 1.1 Unity dll's and now I get an EntryPointNotFoundException inside of the delegate function.  Debugging, I have a valid reference to a UnityContainer but when I call RegisterInstance on it I get the error.  (I also get the error if I try RegisterType.) 

The delegates are registered as events on the Factory.
The Factory is a static class. 
I have tried the delegate itself as both static and non. 
I am not invoking the delegates in a separate thread.
If I move the RegisterInstance or RegisterType call inside the Factory class (rather than calling via the delegate) it works fine.

I am not sure where to start looking to track this down... anyone have any suggestions?

May 27, 2008 at 11:39 PM
If you can, the best way to start is to get a small, standalone app that demonstrates the problem. Then, if the creation of that app doesn't reveal the issue, please send it to me and I'll see what I can do.

May 28, 2008 at 3:40 AM

Thanks for the response.  Part of what had me so confused is that the tests on our ContainerFactory simulated exactly what I was doing in code.... and it all worked.  It was just when I tried to actually *use* the Factory from a dependent project that it died.

I finally tracked it down this afternoon though...  the Factory was actually in a different dll.  I had failed to set the references to the Unity.dll in the ContainerFactory project to the 1.1 dll's, but my client project was using the 1.1's. My guess is that since they were referring to different dll's that's why I got the EntryPointNotFound.

So I drew two conclusions from this:
1) Projects with dependencies that use the UnityContainer must refer to the same version of the dll
2) Projects with dependencies that use the UnityContainer must refer to the exact same dll
Are both of these conclusions accurate? 

BTW, we are loving Unity.  Replaced Spring.Net with it and haven't looked back.