Question

I originally posted: https://stackoverflow.com/questions/15351024/intermittent-errors-with-enterprise-library-using-silverlight-calling-rootvisual

It was titled with the Activation issue like this question Activation error occured while trying to get instance of type LogWriter

However, mine worked fine 90% of the time. It is when certain types of ajax calls are being made. It is like something is getting cached and not cleared out.

The offending line is

this.RootVisual = EnterpriseLibraryContainer.Current.GetInstance<MainPage>();

I did switch to using a Unity container, but I just end up with a different error about the container instead of activation. Seems like there should be a way to clear any DOM or cache happening so that the "this.RootVisual" which is specific to only silverlight and not even in WPF, that it would be ready to use the service locator of Current, or a Container.

Was it helpful?

Solution

You are doing this part correctly:

this.RootVisual = EnterpriseLibraryContainer.Current.GetInstance<MainPage>();

It must be the way in which you are calling it. Without having your codebase and working on your team with your project this is too difficult to say. I have used this code without any problems with Silverlight (RootVisual is only in Silverlight, not even in WPF).

Sadly, based on my research on this question, even if you changed to leveraging a Unity Container, you would end up with container instantiation issues in the same way that "Current" is being used.

If you don't like it, you are really going to have to dig deep and use Fiddler etc.. and navigate the DOM etc.. and figure it out. That or stop using Silverlight etc...

The code is very commonly used without problems from "most people" Here is an example http://entlib.codeplex.com/discussions/285472

Hope this helps, I wish I could solve your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top