2017-08-15 74 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。 –