unit-testing - 在 Visual Studio 中启动单元测试非常慢,重复加载/卸载相同的 dll

标签 unit-testing visual-studio-2013

问题

我在启动单元测试时遇到了严重的延迟(几分钟),而且我是否在调试似乎并不重要。

调试时,我可以在输出窗口中看到有一个包被重复加载和卸载。这种情况确实发生了数千次。

'vstest.executionengine.x86.exe' (CLR v4.0.30319: Domain 929): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.TeamSystem.Licensing.dll'. Symbols loaded.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Common\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Common.dll'. Symbols loaded.

'vstest.executionengine.x86.exe' (CLR v4.0.30319: Domain 929): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Unloaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Unloaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Common\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Common.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Dependency finder domain): Unloaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.TeamSystem.Licensing.dll'

我尝试过...

  • 以管理员身份运行 Visual Studio 2013。
  • 以下解决方案:https://stackoverflow.com/a/14115731/632336 (仅启用我的代码并加载所有符号),但是当我单击按钮时 加载所有符号 Visual Studio 只会崩溃。 (有时 立即,有时在加载完成后)
  • 启用/禁用 Microsoft 符号服务器,这不会导致 差异。
  • 在启用日志记录的情况下启动 Visual Studio,但没有任何内容 这似乎不寻常或与我的问题有关。
  • 从头开始创建一个新的空测试项目。同样的问题

最佳答案

我在我的开发箱中遇到了同样的问题。 我打开 fiddler,发现有很多对“symweb”的调用。

因此,我创建了一个 fiddler 自动应答器规则来丢弃这些调用。 此后,开始测试之前的延迟减少到不到一秒。

enter image description here

关于unit-testing - 在 Visual Studio 中启动单元测试非常慢,重复加载/卸载相同的 dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35175613/

相关文章:

c# - 如何在 Outlook 中添加新选项卡。使用 Visual Studio 2013 进行 Outlook 插件/插件开发

c++ - VC2013 move 运算符不递归执行 move

c# - NUnit 测试 - 循环 - C#

.net - 如何允许程序集(单元测试)访问另一个程序集的内部属性?

unit-testing - Haskell 异常和单元测试

react-native - 如何使用 enzyme Jest 为 React Native 中的导航堆栈编写单元测试用例?

c++ - Visual Studio 2013 不显示未引用的变量警告

security - System.Web.Security 不存在于程序集中

c# - 使用SQL Server 2014 LocalDB和Visual Studio 2013的LightSwitch构建失败

unit-testing - 测试子级时模拟父类行为( protected 方法)