vs 2022:Roslyn代码分析的高RAM和CPU问题
我们在Visual Studio 2022(V.17.2.2 64bit)中有一个巨大的解决方案(ASP.NET MVC,C#)。
Roslyn代码分析始终使用高CPU和RAM。 有没有办法防止这个问题?配置还是其他?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在Visual Studio 2022中,我通过禁用这两项检查来解决它:
之后,Visual Studio效果很好。
In Visual Studio 2022, I've resolved it by disabling these two checks:
after that, Visual Studio works well.
它仍在VS2022 v17.6中进行,
我只能通过从解决方案文件夹中暂时删除我的
.editorConfig
文件来修复它(并重新启动VS)。这意味着问题是我在
.editorConfig
中打开的一些分析器,在某些情况下需要很长时间才能运行。为了弄清楚哪个是造成问题的,我想我必须全部关闭它们,然后一次重新打开一个,看看问题又回来了,但是我没有时间去尝试一下。编辑:我遵循说明打开构建过程的分析和记录,然后查看日志以查看哪些分析仪花费最多的时间。我禁用了这些分析仪,似乎对一些分析仪有所帮助。
编辑:一位花费很长时间的分析仪无法关闭,事实证明是 bug
It's still happening in VS2022 v17.6
I've only been able to fix it by temporarily deleting my
.editorconfig
file from the solution folder (and restarting VS).This implies that the problem is some analyzer that I've turned on in
.editorconfig
that takes a really long time to run under some circumstances. In order to figure out which one is causing the problem I guess I'd have to turn them all off and then turn then back on one at a time to see at which point the problem came back, but I haven't had time to try that.EDIT: I followed the instructions here to turn on analysis and logging of the build process, and then viewing the log to see which analyzers were taking the most time. I disabled those analyzers and it seems to have helped some.
EDIT: One of the analyzers that was taking a long time couldn't be turned off and it turned out to be a bug
显然,这已经解决了VS2022 V17.3
This has apparently been fixed in VS2022 v17.3
https://developercommunity.visualstudio.com/t/vs-2022-high-cpu-use-by-servicehubroslyncodeanalys/1610702