无法从SSDT中的单元测试调试TSQL

时间:2013-07-14 20:46:15

标签: sql-server unit-testing debugging sql-server-2012 sql-server-data-tools

重现的步骤

1.在(localdb)

下创建存储过程

enter image description here

2.定义车身和放置制动点

enter image description here

3.更新项目更改(通过架构更新)

enter image description here

4.创建单元测试(在项目菜单中)

enter image description here

5.定义单元测试主体

enter image description here

6.Debug单元测试

enter image description here

结果 - 没有任何反应......断点(来自第2步)根本没有发射。

输出窗口产生下一个输出:

*Done building target "SqlDeploy" in project "test3.sqlproj".
Done building project "test3.sqlproj".
Build succeeded.
C:\Users\amorozov\Documents\Visual Studio 2012\Projects\Trash\test3\test3\bin\Debug\test3.sql : Deploy warning SQL72030: The project and target databases have different collation settings. Deployment errors might occur.
    1 Warning(s)
    0 Error(s)
Time Elapsed 00:00:07.73
Executing test script...
1 batches, 2 ResultSets, 2 rows affected
Validating scalarValueCondition1
The thread '.NET SystemEvents' (0x1938) has exited with code 0 (0x0).
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>vstest.executionengine.x86.exe</AppDomain><Exception><ExceptionType>System.AppDomainUnloadedException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Attempted to access an unloaded AppDomain.</Message><StackTrace>
</StackTrace><ExceptionString>System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.</ExceptionString></Exception></TraceRecord>
The thread 'In-proc Node (Default)' (0xcc8) has exited with code 0 (0x0).
The thread '<No Name>' (0x1b54) has exited with code 0 (0x0).
The program '[6040] vstest.executionengine.x86.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).*

我在输出中看到的唯一奇怪的事情 - <ExceptionString>System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.</ExceptionString>

我能够在工作和家中重现这种行为。 两个系统都是一样的:

  • VS2012 Premium(更新3)
  • Windows 8 64位/ Windows Server 2012 64位

enter image description here

有人有此功能吗?

我做错了什么?

1 个答案:

答案 0 :(得分:0)

感谢您提出这一点 - 这似乎是SSDT中的一个错误,我们创建了一个缺陷来跟踪此问题。您仍然可以从“新查询”窗口调试存储过程 - 请参阅steps listed here。但是目前看起来你不能在单元测试期间调试存储过程。