问题
我在启动单元测试时遇到了严重的延迟(几分钟),而且我是否在调试似乎并不重要。
调试时,我可以在输出窗口中看到有一个包被重复加载和卸载。这种情况确实发生了数千次。
'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 自动应答器规则来丢弃这些调用。 此后,开始测试之前的延迟减少到不到一秒。
关于unit-testing - 在 Visual Studio 中启动单元测试非常慢,重复加载/卸载相同的 dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35175613/