2012-08-11 78 views
0

我想加載一個模塊使用配置文件,但不斷得到以下異常。無法加載模塊使用配置文件

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

找到解決我的問題。當模塊的Initialize()方法尚未實現時,似乎會出現此錯誤。

public class HelloWorldModule : IModule 
{ 
    public void Initialize() 
    { 
     throw new NotImplementedException(); 
    } 
} 

但是,這仍然wiered作爲調試器應該拋出錯誤NotImplementedException而不是其他人。