2009-11-03 52 views
1

我們有超過1000個單元測試。前一段時間,他們中的18個與其他測試一起運行時開始失敗。這些測試運行一個Windows工作流程。錯誤:運行單元測試時編譯鎖定

如果他們單獨運行,他們會通過。

  • 該錯誤似乎是它無法找到連接字符串。
  • 它無法找到連接字符串,因爲它不知道看哪個配置文件。
  • 它不知道看哪個配置文件,因爲它無法找到應用程序上下文
  • 它不能找到應用程序上下文由於編譯鎖定。

任何人有任何想法可能是錯的,以及如何解決這個問題?我得到的錯誤是:

Message: Exception message: The 
supplied connection string is not 
valid, because it contains 
insufficient mapping or metadata 
information. Parameter name: 
connectionString Inner exception : 
System.InvalidOperationException: 
Unable to determine application 
context. The ASP.NET application path 
could not be resolved. ---> 
System.Reflection.TargetInvocationException: 
Exception has been thrown by the 
target of an invocation. ---> 
System.Web.HttpException: The type 
initializer for 
'System.Web.Compilation.CompilationLock' 
threw an exception. ---> 
System.TypeInitializationException: 
The type initializer for 
'System.Web.Compilation.CompilationLock' 
threw an exception. ---> 
System.NullReferenceException: Object 
reference not set to an instance of an 
object. at 
System.Web.Compilation.CompilationLock..cctor() 
--- End of inner exception stack trace --- at System.Web.Compilation.CompilationLock.GetLock(Boolean& 
gotLock) at 
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() 

感謝

西拉

回答

2

既然你提到你的測試運行WF的工作流程,我猜想,以前的測試運行具有一個或多個工作流實例是仍然在某個線程上運行,因此鎖定編譯器,因爲程序集仍然在某個進程中加載​​。

你可以打開任務管理器並調查是否有正在運行的進程仍然在某處使用工作流?如果是這樣,殺死它,看看你是否無法編譯。