开发者

Error: Compilation Lock when running unit tests

开发者 https://www.devze.com 2022-12-10 14:41 出处:网络
We have over 1000 unit tests. A while ago 18 of them started to fail when they were run together with the other tests. These tests run a windows workflow.

We have over 1000 unit tests. A while ago 18 of them started to fail when they were run together with the other tests. These tests run a windows workflow.

If they are run alone they pass.

  • The error appears to be that it cannot find the connection string.
  • It cannot find the connection string because it does not know which config file to look in.
  • It does not know which config file to look in because it cannot find the application context
  • And it cannot find the application context due to a compilation lock.

Anybody have any idea what could be wrong, and how to fix this? The error I am getting is:

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 resolve开发者_运维问答d. --->
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()

Thanks

Shiraz


Since you mention that your tests run a WF workflow, I would guess that a previous test run has one or more workflow instances that still run on a thread somewhere, thus locking the compiler because the assemblies are still loaded in a process somewhere.

Can you open Task Manager and investigate whether there's a running process that still uses the workflow somewhere? If so, kill it and see if you can't compile.

0

精彩评论

暂无评论...
验证码 换一张
取 消