Attaching Visual Studio debugger causes high CPU usage and UI thread locks

不羁的心 提交于 2019-12-13 06:49:16

问题


I have a WPF app that does some async networking (negotiation over 100 sockets in parallel). If I launch app with VS debugger attached and start networking code my CPU usage jumps to 60% (shared between VS, VS debugger and vshost processes) and UI becomes very unresponsive with constant freezes up to 3 seconds. The same happens when I attach a debugger to already running process. Under normal conditions it uses 1-3% CPU and UI is smooth.

VS profiler in "CPU usage" mode shows that CPU is used by [External code]

How do I troubleshoot this issue?


回答1:


If you just throw the Exception, how did you really handle this Exception?

For example, if the client sends the requests to the server side, and server side gives the responses to the client, but your client can't really handle the response with some Exceptions, I think it would impact your UI process which may have high CPU usage or others.

So the real cause is that what the Exception is and how to really resolve/handle this Exception.

To avoid seeing that messages, right-click on the output window and uncheck "Exception Messages" is a workaround, but find the real reason and resolve it would be a better solution.



来源:https://stackoverflow.com/questions/39304865/attaching-visual-studio-debugger-causes-high-cpu-usage-and-ui-thread-locks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!