2009-11-03 86 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的工作流程,我猜想,以前的测试运行具有一个或多个工作流实例是仍然在某个线程上运行,因此锁定编译器,因为程序集仍然在某个进程中加载​​。

你可以打开任务管理器并调查是否有正在运行的进程仍然在某处使用工作流?如果是这样,杀死它,看看你是否无法编译。