WPF Application stalls/freezes after first interaction, like button click

老子叫甜甜 提交于 2019-12-06 20:59:44

问题


I'm currently experiencing a problem in WPF. The UI loads fine, but whenever the first user interaction is made, such as a button click, the application seems to stall, or example if I had two buttons that display a MessageBox, the first click will wait for a few seconds then show the MessageBox, but any subsequent interaction is instantaneous and responsive.

Has anyone else experienced this? And if so, is there any solution?

Thanks


回答1:


I had the same problem. Every time I called the first interaction from a Button or ICommand the UI would freeze for like half a second.

I tracked down the issue with the hint of the author to start application directly from the folder. This solved the issue, but I also wanted to know why this happens and thought about what the difference is between direct execution and debugging.

So I figured out that IntelliTrace caused the freeze, which was still enabled since I activated it once for debugging an ADO.NET application. After disabling, the UI Freeze is gone. To disable it go to Debug -> IntelliTrace -> Open IntelliTrace Settings -> untick "Enable IntelliTrace".




回答2:


Thanks for reporting this performance issue. We have looked into it and tracked it down. We are looking into fixing this in a future release. Below are steps to work around this issue. Once the work around is applied there is no need to disable ‘Gesture’ events or IntelliTrace.

  1. Open up a cmd window under Admin account
  2. cd /d "%programfiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE\Remote Debugger\x64"
  3. %windir%\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install /NoDependencies /ExeConfig:.\msvsmon.exe Microsoft.VisualStudio.vil.host.dll

If you are using a VM you might want to first save a snapshot before applying the work around. Let us know if you run into any other issues. Thanks.

Azeem Khan



来源:https://stackoverflow.com/questions/12885803/wpf-application-stalls-freezes-after-first-interaction-like-button-click

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