Issue locating Type from exported and loaded module

Topics: Prism v4 - Silverlight 4
Sep 26, 2011 at 4:16 PM

I am trying to load a module from a XAP file within my Boot Strapper and I am gettting an exception that its unable to locate the module with type "BPO.Assets.Productivity.Core.Module.CoreModule, BPO.Assets.Productivity.Core, Version=1.0.0.0, Culture=neutral" amoung the exported modules ... 

Here is the code in the BPO.Assets.Productivity.Core Modules\CoreModule.cs

using Microsoft.Practices.Prism.MefExtensions.Modularity;
using Microsoft.Practices.Prism.Modularity;

namespace BPO.Assets.Productivity.Core.Module
{
   
    [ModuleExport(typeof(CoreModule))]
    public class CoreModule : IModule 
    {
      

        #region IModule Members

        public void Initialize()
        {
            
             
        }

        #endregion
    }
}

 ... and here is the CreateModuleCatalog code in my MEF based bootstrapper ...

protected override IModuleCatalog CreateModuleCatalog()
        {
            var moduleCatalog = new ModuleCatalog();


            moduleCatalog.AddModule
            (
                new ModuleInfo
                {
                    InitializationMode = InitializationMode.WhenAvailable,
                    Ref = @"http://mymach/ProductivityTool/ClientBin/BPO.Assets.Productivity.Core.xap",
                    ModuleName = "CoreModule",
                    ModuleType = "BPO.Assets.Productivity.Core.Module.CoreModule, BPO.Assets.Productivity.Core, Version=1.0.0.0, Culture=neutral"

                }
            );

            return moduleCatalog;
        }

The xap file is sitting on my localhost IIS and has a proper client access policy there as well. 

I can see from Fiddler that both the ClientAccess Policy as well as the xap file are located and loaded with out issue at runtime.

Just to be certain, I made a copy and renamed the BPO.Assets.Productivity.Core.xap file within the IIS folder to a zip extension then using ILDasm inspected the BPO.Assets.Productivity.Core.dll and found that the CoreModule is where I think it should be within that assembly.

Yet, shortly after the module is loaded I get an exception that its unable to locate the module with type "BPO.Assets.Productivity.Core.Module.CoreModule, BPO.Assets.Productivity.Core, Version=1.0.0.0, Culture=neutral" amoung the exported modules ...

So I see it's loading the correct XAP file, I also see that the assembly BPO.Assets.Productivity.Core resides within that xap file. I also see, using ILDasm, that within that assembly there exists the appropriate type which supports the IModule interface.

Am I missing some type of policy setting step to allow for this module to be loaded? Do I need to add any config to my web config file? 

 

Sep 26, 2011 at 6:07 PM

I decided to simplify my problem as such I created a much simpliler test module and it loads without issue following the exact same steps as above.

I suspect that there is some other dependency concern that is the real route cause of my issue.    I will update this for others once I gain an understanding as to what it is.