简体   繁体   English

Silverlight应用程序中未处理的错误无法找到模块

[英]Unhandled Error in Silverlight Application Unable to locate the module

My solution contains 4 Silverlight projects - one main, two module projects and last one share project (for common interfaces etc). 我的解决方案包含4个Silverlight项目-一个主项目,两个模块项目和最后一个共享项目(用于通用接口等)。

Main and module projects don't have references to each other (just to share project). 主项目和模块项目之间没有相互引用(只是共享项目)。

You can find definitions of my modules below: 您可以在下面找到我的模块的定义:

[ModuleExport("ServiceModule", typeof(ServiceModule), InitializationMode = InitializationMode.WhenAvailable)]
public class ServiceModule : IModule

[ModuleExport("ViewModule",
    typeof(ViewModule),
    DependsOnModuleNames = new string[] { "ServiceModule" },
    InitializationMode = InitializationMode.WhenAvailable)]
public class ViewModule : IModule

And I added modules to ModuleCatalog into derived MefBootstrapper class of main project (I used code registration of modules instead of CreateFromXaml method): 然后将模块添加到ModuleCatalog中,并将其添加到主项目的派生MefBootstrapper类中(我使用模块的代码注册来代替CreateFromXaml方法):

protected override void ConfigureModuleCatalog()
{
    ModuleCatalog.AddModule(
      new ModuleInfo()
      {
          ModuleName = "ServiceModule",
          ModuleType = "SilverlightEnabledService.ModuleDefinitions.ServiceModule, SilverlightEnabledService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ca4f032071a86aea",
          Ref = "SilverlightEnabledService.xap",
          InitializationMode = InitializationMode.WhenAvailable
      }
    );

    ModuleCatalog.AddModule(
      new ModuleInfo()
      {
          ModuleName = "ViewModule",
          ModuleType = "RedOrBlackModule.ModuleDefinitions.ViewModule, RedOrBlackModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ca4f032071a86aea",
          Ref = "RedOrBlackModule.xap",
          InitializationMode = InitializationMode.WhenAvailable,
          DependsOn = (new Collection<string>(new string[] { "ServiceModule" }))
      }
    );
}

As see from code above, ModuleCtalog module name is the same as module name in ModuleExportAttribute, but I get exception below: 从上面的代码中可以看到,ModuleCtalog模块名称与ModuleExportAttribute中的模块名称相同,但是在以下情况下出现异常:

Uncaught Error: Unhandled Error in Silverlight Application Unable to locate the module with type 'SilverlightEnabledService.ModuleDefinitions.ServiceModule, SilverlightEnabledService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ca4f032071a86aea' among the exported modules. 未捕获的错误:Silverlight应用程序中的未处理错误无法在导出的模块中找到类型为'SilverlightEnabledService.ModuleDefinitions.ServiceModule,SilverlightEnabledService,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = ca4f032071a86aea'的模块。 Make sure the module name in the module catalog matches that specified on ModuleExportAttribute for the module type. 确保模块目录中的模块名称与在ModuleExportAttribute上为模块类型指定的名称匹配。 в Microsoft.Practices.Prism.Modularity.ModuleInitializer.HandleModuleInitializationError(ModuleInfo moduleInfo, String assemblyName, Exception exception)... Microsoft.Practices.Prism.Modularity.ModuleInitializer.HandleModuleInitializationError(ModuleInfo moduleInfo,String assemblyName,Exception exception)...

It seems very easy issue but I cannot find solution yet. 似乎很简单的问题,但我找不到解决方案。

There are several reasons why the module might not be found. 有几个原因可能导致找不到该模块。 See this blog post for an overview of what they are and how to debug them: How to Debug and Diagnose MEF Failures . 请参阅此博客文章,以概述它们是什么以及如何对其进行调试: 如何调试和诊断MEF故障

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Silverlight 4.0:Silverlight应用程序中的未处理错误[Async_ExceptionOccured] - Silverlight 4.0: Unhandled Error in Silverlight Application[Async_ExceptionOccured] Silverlight未处理的错误 - Silverlight Unhandled Error Silverlight应用程序代码中未处理的错误:4004 System.Collections.Generic.KeyNotFoundException - Unhandled Error in Silverlight Application Code: 4004 System.Collections.Generic.KeyNotFoundException 无法看到数据透视列表应用程序模板 - silverlight - Unable to see Pivot List Application Template - silverlight 无法在Silverlight 4应用程序中记录编码的UI测试 - Unable to record Coded UI tests in Silverlight 4 application Silverlight设计师未处理的异常 - Silverlight designer unhandled exception crystal在安装时报告silverlight应用程序中的错误 - crystal reports error in silverlight application on installation 无法在Silverlight业务应用程序中更新和删除数据库视图 - Unable update and delete database views in silverlight business application 使用WCF服务托管Silverlight应用程序页面时出错 - Error hosting Silverlight application page with WCF service Silverlight 4导航中是否有类似于“ locate.replace()”的模型? - Is there an analog to “locate.replace()” in Silverlight 4 Navigation?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM