2017-08-15 30 views
0

我一直面臨一個不尋常的問題,在我的單元測試項目中,我收到了這個錯誤,同時奇怪的是一些通常會通過的測試,在下次運行時失敗。有了這個錯誤,我也得到AutoMapperMappingExceptions,雖然我想加載程序集中的所有配置文件。我也檢查過我的app.config,以防潛在的錯誤。我正在運行xunit2,automapper 3.2.1。我附加了一部分堆棧跟蹤System.Configuration.ConfigurationErrorsException使用xunit2和automapper

System.Configuration.ConfigurationErrorsException 
    Configuration system failed to initialize 
    at System.Configuration.ConfigurationManager.PrepareConfigSystem() 
    at System.Configuration.ConfigurationManager.GetSection(String sectionName) 
    at System.Web.Configuration.ClientRuntimeConfig.GetSectionObject(String sectionName) 
    at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index) 
    at System.Web.Configuration.RuntimeConfig.get_HttpRuntime() 
    at System.Web.Util.HttpEncoder.GetCustomEncoderFromConfig() 
    at System.Lazy`1.CreateValue() 
    --- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 
    at System.Lazy`1.get_Value() 
    at System.Web.Util.HttpEncoder.get_Current() 
    at System.Web.HttpUtility.HtmlDecode(String s) 

回答

0

這是一個框架錯誤,它與AM無關。格式錯誤的配置文件會導致這個例子。應該有更多細節的內部例外。

+0

你的意思是畸形的配置文件是什麼?我已經檢查過app.config和package.config。 –