XAP Load Fails for Silverlight 4

Topics: Prism v2 - Silverlight 3
Apr 12, 2010 at 5:01 PM
Edited Apr 12, 2010 at 5:46 PM

Not sure if the SL 4 version is relavant.  I had a XAP module that I am able to load from my main app (the shell) if I directly reference it but it always throws an exception when I try to load it remotely using either code behind or configuration.  The exact exception is: ModuleInitializerException

Error message is:

"Unable to retrieve the module type MobileGuide.Modules.Admin.AdminModule, MobileGuide.Modules.Admin, Version=1.0.0.0 from the loaded assemblies.  You may need to specify a more fully-qualified type name."

Stack trace is:

at Microsoft.Practices.Composite.Modularity.ModuleInitializer.HandleModuleInitializationError(ModuleInfo moduleInfo, String assemblyName, Exception exception)
   at Microsoft.Practices.Composite.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
   at Microsoft.Practices.Composite.Modularity.ModuleManager.InitializeModule(ModuleInfo moduleInfo)
   at Microsoft.Practices.Composite.Modularity.ModuleManager.LoadModulesThatAreReadyForLoad()
   at Microsoft.Practices.Composite.Modularity.ModuleManager.OnModuleTypeLoaded(ModuleInfo typeLoadedModuleInfo, Exception error)
   at Microsoft.Practices.Composite.Modularity.XapModuleTypeLoader.OnDownloadCompleted(Object o, DownloadCompletedEventArgs e)
   at Microsoft.Practices.Composite.Modularity.FileDownloader.WebClient_OpenReadCompleted(Object sender, OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OpenReadOperationCompleted(Object arg)

The configuration xaml is:

<prism:ModuleCatalog xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:prism="clr-namespace:Microsoft.Practices.Composite.Modularity;assembly=Microsoft.Practices.Composite">
      <prism:ModuleInfoGroup InitializationMode="WhenAvailable">
        <prism:ModuleInfo ModuleName="MainModule" ModuleType="MobileGuide.MainModule, MobileGuide, Version=1.0.0.0"/>
    </prism:ModuleInfoGroup>
    <prism:ModuleInfoGroup InitializationMode="OnDemand">
        <prism:ModuleInfo Ref="MobileGuide.Modules.Admin.xap" ModuleName="AdminModule" ModuleType="MobileGuide.Modules.Admin.AdminModule, MobileGuide.Modules.Admin, Version=1.0.0.0" />
    </prism:ModuleInfoGroup>
</prism:ModuleCatalog>

Assembly is: MobileGuide.Modules.Admin; Namespace is: MobileGuide.Modules.Admin; Module name is: AdminModule

Anyone else seen this? Am I doing something obvious;y wrong?  I'm wondering if there's an issue if the namespace and the assembly name are the same??

cheers

tim

Apr 12, 2010 at 10:59 PM

Figured it out....I fired up Reflector and checked out the assmbly and for some reason I can't understand, the module wasn't actually being generated.  i just created a new Silverlight App "module" and ported all my code and its working now.  Weird. Might have been a VS2010 RC hiccup!!