查找以模态形式进行的无限循环? [英] Find infinite loop in progress in a modal form?

查看:94
本文介绍了查找以模态形式进行的无限循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我的应用程序开始消耗最大的CPU,并且GUI变得无响应.也许1/50尝试重现此成功.

On occasion my app begins to consume maximum CPU and the GUI becomes unresponsive. Maybe 1/50 attempts to reproduce this succeed.

基于高CPU使用率,它显然正在运行(未被外部阻止),但是我不确定如何在调试器中标识执行的位置.

Based on the high CPU usage it obviously is running (not blocked externally) but I'm not sure how to identify in the debugger where the execution is taking place.

此问题的情形如下:

  • 应用启动
  • 用户使新的模式窗口打开
  • 用户在此窗口中工作一段时间
  • 最终窗口冻结"(有时)

这是我要调试的最后一个事件.

It is this last event which I am trying to debug.

我已遵循发现正在进行的无限循环的建议?中断调试器,使其仅停留在此行上:

I have followed the advice in Find infinite loop in progress? but when I break in the debugger it just lands on this line:

return f.ShowDialog();

我不确定为什么这就是调试器认为是当前正在执行的行.我没有创建任何线程.

I'm not sure why this is what the debugger considers to be the current executing line. I am not creating any threads.

在模态窗口的上下文中有什么方法可以调试这种情况?

Is there any way to debug this situation in the context of a modal window?

推荐答案

感谢发表评论的人们,这是成功的方法.或者至少,它为该问题提供了一些宝贵的启示:

Thanks to people who commented, this was the approach that turned out to be successful. Or at least, it shed some valuable light on the issue:

  • 运行应用程序,直到出现问题

  • Run the app until the problem occurs

运行Process Explorer并找到应用程序的过程

Run Process Explorer and find the app's process

打开该进程的属性窗口

查看正在运行的线程,并确定正在使用所有CPU的线程.

View the threads which are running and identify which one is using all the CPU.

查看该线程的堆栈跟踪

就我而言,我可以看到在堆栈跟踪中几乎所有时间都花在了wpfgfx_v0400.dll中的函数内部,主要是在函数Utility_PolygonBoundsUtility_PathGeometryBounds中.

In my case, I could see that in the stack trace nearly all the time is being spent inside functions in wpfgfx_v0400.dll, mostly in functions Utility_PolygonBounds or Utility_PathGeometryBounds.

我还将在与WPF相关的任何代码中/在后面的代码中设置成千上万个断点,但没有一个被命中.因此,它似乎确实陷入了该库中.我已经针对该问题发布了一个单独的问题:应用程序冻结在wpfgfx_v0400.dll Utility_PolygonBounds和Utility_PathGeometryBounds中吗?

I'd also set zillions of breakpoints in any WPF-related code / code-behind, and none of them are hit. So it really seems to be getting stuck inside that library. I have posted a separate question specifically about that issue: App frozen inside wpfgfx_v0400.dll Utility_PolygonBounds and Utility_PathGeometryBounds?

这篇关于查找以模态形式进行的无限循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆