Visual Studio 2015 启动后无响应的原因和对策 / Cause and solution of Visual Studio 2015 not responding after starting up

Date:

Author:


针对 Visual Studio 2015 启动后长时间无响应的问题,给出原因并提出对策。

This post aims at giving the causation and providing the solution of Visual Studio 2015 not responding after starting up.

1. 现象

Visual Studio 2015 启动(不管是否打开较大的解决方案)约一分钟后会假死一段时间,期间会占满 CPU 的一个核,并出现大量磁盘操作。

2. 原因

devenv.exe 在启动后会读写 <AppData>/Local/Microsoft/VSCommon/14.0/SQM/ 下的大量 .sqm 文件,这些文件与网络连接失败有关1。MsMpEng.exe(反恶意软件服务,Windows Security / Windows Defender 后台进程)也会同步扫描这些文件,并大幅拖慢 devenv.exe 的读写过程。

注 1:参考 Slow Visual Studio, related to SQMClient? – Stack Overflow

3. 对策

  1. 可将 .sqm 文件全部删除(建议在命令行操作,在资源管理器中删除大量文件会非常耗时)。
  2. 在 Windows 安全中心(Windows Security / Windows Defender)的「病毒和威胁防护」(Virus & threat protection)中转到「管理设置」(Manage settings),在「排除项」(Exclusions)中选择「添加或删除排除项」(Add or remove exclusions)。使用其他防护软件替换 Windows 安全中心且存在此问题时,自行查找设置方法。

完成上述处理后,Visual Studio 2015 在每次启动和关闭时仍会写入大量 .sqm 文件(文件数量与打开的工程数有关)。因此,第 2 项是有必要的,第 1 项也需定期操作。


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.