Odd Module Load Issue

Topics: Prism v2 - Silverlight 3
Sep 15, 2010 at 12:50 AM

My app is calling a WCF service that returns a list of Module Names to load.

In this particular case, 5 module names are being returned.

Here is the odd part, when I load the modules from the following callback, only the last one in the list appears to load:

 

private void OnGetAllowedModulesComplete(IEnumerable<string> moduleList)
{
    foreach (var name in moduleList)
    {
        Deployment.Current.Dispatcher.BeginInvoke(() => _moduleManager.LoadModule(name));
    }
}

However, if I change the call to the following...they all load!

 

private void OnGetAllowedModulesComplete(IEnumerable<string> moduleList)
{
    moduleList.ToList().ForEach(
        m => Deployment.Current.Dispatcher.BeginInvoke(() => _moduleManager.LoadModule(m)));
}

This has been driving me crazy - any explanations anyone may have would be fantastic! Maybe something to do with the use of IEnumerable<string>??

Sep 17, 2010 at 3:57 PM

Hi,

This is certainly strange, it should be working. I would suggest you to reproduce this in an isolated scenario, since it might help you on finding a reason. If you continue experiencing this, could you send a repro solution of your scenario?

Fernando Antivero
http://blogs.southworks.net/fantivero