【问题标题】:Clean Install VS Compile Performance Problems全新安装 VS 编译性能问题
【发布时间】:2016-09-29 11:11:22
【问题描述】:

问题

即使是一个全新的未经编辑的空控制台应用程序项目,VS 也需要 25 秒才能编译

我的尝试

我最近注意到了这个性能问题,但我不确定它是什么时候开始的,所以为了安全起见,我采取了以下措施...

一些关键观察

  • 这个问题似乎只影响VS
  • cpu、ram、磁盘和网络的资源使用率很低
  • PC 规格相当高(第 6 代 i7、SSD、16GB 内存)

更新

我通过电子邮件与一些 Microsoft 人员交谈,他们已将范围缩小到 VS 在构建过程中以某种方式用于“共享资源”的“roslyn 编译器服务器”(我不完全了解详细说明我自己)

总而言之,您可以通过使用“开发人员命令提示符”执行此操作来确定您是否有同样的问题......

...第一行设置了一个环境变量,告诉 roslyn 将其活动记录到文件中,这对我来说产生了这个...

--- PID=8144 TID=9 Ticks=17865781: CommandLine = ' /noconfig'
--- PID=8144 TID=9 Ticks=17865781: BuildResponseFile = '/nowarn:1701,1702 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Net.Http.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\ConsoleApplication1.exe /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /target:exe /utf8output Program.cs Properties\AssemblyInfo.cs "C:\Users\PaulW\AppData\Local\Temp\.NETFramework,Version=v4.5.2.AssemblyAttributes.cs"'
--- PID=8144 TID=9 Ticks=17865781: Attempting to create process 'C:\Program Files (x86)\MSBuild\14.0\bin\VBCSCompiler.exe'
--- PID=8144 TID=9 Ticks=17865781: Successfully created process with process id 2080
--- PID=8144 TID=9 Ticks=17865781: Attempt to open named pipe 'PaulW.True.GE6kSCQEbMXsysJ19S0qExhvU5zqX2Bc34kg0RSsgmc'
--- PID=8144 TID=9 Ticks=17865781: Attempt to connect named pipe 'PaulW.True.GE6kSCQEbMXsysJ19S0qExhvU5zqX2Bc34kg0RSsgmc'
--- PID=8144 TID=9 Ticks=17890781: Connecting to server timed out after 20000 ms

.. 微软注意到最后一行是关键,似乎 VS 中的“编译器服务器”正在做一些它不应该做的事情,因此没有正确响应构建过程请求导致这种延迟。

【问题讨论】:

  • 是否禁用了杀毒软件?对其他驱动器的影响相同?
  • 除windows defender外没有安装,我可以禁用我想再次测试

标签: performance visual-studio compilation


【解决方案1】:

一般来说,上述问题的发生是因为 roslyn 日志中的超时。

发生超时可能是因为编译器服务由于某种原因而死亡,因此,如果您在运行时打开文件“C:\Program Files (x86)\MSBuild\14.0\bin\VBCSCompiler.exe”,则您很可能会遇到异常,并且阅读该异常会告诉您更多关于问题的确切原因。

感谢 Jared Parsons @ Microsoft 提供关于此的关键信息 :)

【讨论】:

    猜你喜欢
    • 2012-08-27
    • 2013-08-26
    • 1970-01-01
    • 1970-01-01
    • 2021-06-21
    • 1970-01-01
    • 2015-07-08
    • 1970-01-01
    • 2020-08-22
    相关资源
    最近更新 更多