我正在尝试使用配置文件加载模块,但仍然遇到以下异常。
An exception occurred while initializing module 'HelloWorld'.
- The exception message was: The method or operation is not implemented.
- The Assembly that the module was trying to be loaded from was:HelloWorld, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
Check the InnerException property of the exception for more information. If the exception
occurred while creating an object in a DI container, you can exception.GetRootException()
to help locate the root cause of the problem.
我有以下App.config文件。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="modules" type="Microsoft.Practices.Prism.Modularity.ModulesConfigurationSection, Microsoft.Practices.Prism"/>
</configSections>
<modules>
<module assemblyFile="HelloWorld.dll" moduleType="HelloWorld.HelloWorldModule, HelloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" moduleName="HelloWorld" startupLoaded="true" />
</modules>
</configuration>
我已经仔细检查了dll名称,命名空间和类型名称,我甚至从头开始重新创建项目,但错误仍然显示出来。请帮我解决这个问题,因为我已经被困了几个小时了。感谢。
答案 0 :(得分:0)
找到解决我问题的方法。当模块的Initialize()方法尚未实现时,似乎会出现此错误。
public class HelloWorldModule : IModule
{
public void Initialize()
{
throw new NotImplementedException();
}
}
但由于调试器应该抛出错误NotImplementedException而不是其他错误,所以仍然会继续这样做。