"Entry point was not found" in Blend

Apr 25, 2010 at 11:58 AM
Edited Apr 25, 2010 at 12:33 PM

Hi

I am having some problems with the commonservicelocator in blend.

The problem arises when I try to fetch the correct viewmodel for my controls datasource using CommonServiceLocator with Unity.

Everything works great in runtime but when I try to edit my view in blend, my controls lack data.

Some debugging shows that an error is cast in the background: "Entry point was not found".

It works without problem if I use the unitylocator directly.

 

I.E. This code works in both runtime and blend:

 

UnityServiceLocator locator = new UnityServiceLocator(container);
ViewModel = locator.GetInstance<TViewModel>();

 

 

But this code works in runtime but crashes in blend:

 

UnityServiceLocator locator = new UnityServiceLocator(container);
ServiceLocator.SetLocatorProvider(() => locator);
ViewModel = ServiceLocator.Current.GetInstance<TViewModel>();

 

 

Does anyone know what is going wrong, can I work around this?

The obvious workaround for me is to use Unity directly, but it would be great if I could use the commonservicelocator in case I ever want to replace Unity with another framework.

Note: I am using the silverlight version.

May 17, 2010 at 5:27 PM

I had a similar issue trying to add a Domain Service in Visual Studio 2010. I ended up just putting the ServiceLocator dll in the GAC and everything now works.