Application.Run(形式)吊 [英] Application.Run(form) is hanging

查看:201
本文介绍了Application.Run(形式)吊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常奇怪的情况。我们有一个比较大的应用程序(的〜code 500K线),由10个不同的开发商向上在过去6年的发展。它一直工作正常,直到我们的最新版本。随着最新版本,我们有多个客户的抱怨,这是偶尔挂和我们有一个时间赫克搞清楚如何/为什么!下面是一些使之成为具有挑战性的事情调试:

I have a very strange situation. We have a relatively large app (~500K lines of code), developed by upwards of 10 different developers over the last 6 years. It has been working fine until our most recent release. With the latest build, we have multiple customers complaining that it is sporadically hanging and we are having a heck of a time figuring out how/why! Here are some of the things making it challenging to debug:

  • 直到今天早上,我们已经完全无法在内部重现此问题。
  • 我们已从来没有看到这种情况发生当调试器附着!这显然​​使得它具有挑战性的解决。
  • 这并不容易,当人们正在使用的应用程序的情况发生,但他们使用了一段时间已经停止了,而之后。
  • 难道这(也许)是与屏幕保护程序来临?
  • 这似乎改变屏幕分辨率时发生的有点一贯
  • Until this morning, we have been totally unable to reproduce this problem in house.
  • We have never seen this happen when the debugger is attached! This obviously makes it challenging to solve.
  • This does not tend to happen when people are using the app, but rather after they've stopped using it for some time.
  • Could this (maybe) be related to the screen saver coming on?
  • It seems to happen somewhat consistently when changing screen resolutions

今天上午,我们终于想通了如何重现至少有一个场景在内部:   - 运行调试器之外的应用程序   - 改变屏幕分辨率。这挂程序。   - 然后我们就可以用调试器附加

This morning we finally figured out how to reproduce at least one scenario in house by: - Running that app outside of the debugger - Changing the screen resolution. This hangs the app. - Then we can attach with the debugger.

该问题,但(现在我们可以,至少在一种情况下,重现它)是时,它挂起了code没有运行!换句话说,只有一个线程中运行在它挂起的时间,并且它打破上线是Application.Run(形式);从Program.cs中。

The problem though (now that we can, at least in one case, reproduce it) is that our code is not running when it hangs! In other words, there is only one thread running at the time it hangs, and the line it breaks on is the Application.Run(form); from program.cs.

最后一点是,该应用程序是不是完全雄。特别:   - 它仍然屏幕上画(刷新屏幕所覆盖的其他应用程序,例如部分)   - 我不能点击所显示的UI元素,但它也没有哔的我,就像我所期望的,如果它是完全不响应   - 安装调试后,当我暂停的应用程序,我可以最小化/最大化而暂停。否则,将不响应最小化/最大化命令。   - 除了没有蜂鸣我,它的行为就好像有一个模态窗口关闭屏幕,我只是看不到。其他(如前所述),如果我暂停的应用程序,它会暂停在Application.Run线,并且有在主题列表中没有其他线程/ code运转(因为我希望看到是否有分别为一个模式对话框阻塞主窗口。

One final point is that the application is not completely hung. Specifically: - It still does screen painting (refreshes parts of the screen covered by other apps for example) - I can't click on the UI elements that are shown, but it also doesn't "beep" at me like I would expect if it were completely unresponsive - When I "pause" the application after attaching the debugger, I can minimize/maximize it while paused. Otherwise, it won't respond to minimize/maximize commands. - Other than not beeping at me, it behaves as though there is a modal window off-screen that I just can't see. Additional (as mentioned before), when I pause the app, it pauses on the Application.Run line, and there are no other threads/code running in the threads list (as I would expect to see if there were a modal dialog box blocking the main window.

该行为是最奇怪恕我直言 - 尤其是因为它只是在最近才开始发生。我的下一个步骤是将必须开始减的code节,直到我找到罪魁祸首,但我想我会抛出这个问题在这里第一次,看看是否有人曾经经历过这样的事之前。

The behavior is most strange IMHO - especially since it has only recently started happening. My next steps are going to have to be to start "subtracting" sections of the code until I find the culprit, but I figured I'd throw the problem up here first and see if anyone else has ever experienced anything like this before.

先谢谢您的任何指导意见 - 我期待着听到任何建议

Thanks in advance for any guidance - I look forward to hearing any suggestions.

EJ

编辑: 中陈述行为的另一种方式。之后它已经挂,它的行为就好像它没有问题,但它从我的鼠标和键盘没有消息。换句话说,它还是重画本身,并且可以通过Visual Studio 2010的调试程序被暂停,但不做出反应的任何方式或形式鼠标/键盘事件。在这里再次,虽然,它不会启动我发出蜂鸣声,因为它确实与那些真正死亡的其他应用程序。象,它的不是显示作为反应迟钝,在任务管理器。它只是在一种奇怪的我不想听的I / O了,对不起!状态......奇怪!

Another way of stating the behavior. After it has "hung" it behaves as though it has no problem, except that it receives no messages from my mouse and keyboard. In other words, it still repaints itself, and can be paused by the VS2010 debugger, but does not respond in any way shape or form to mouse/keyboard events. Here again though, it doesn't start beeping at me as it does with other apps that are truly dead. Like, it does not show as being unresponsive in the task manager. It's just in a sort of weird "I'm not listening for I/O anymore, sorry!" state... Strange!

编辑:

在我最后的编辑,我提到,这是不接受的IO了。这引起了我这样想,我增加了一个的TcpListener,看看是否仍然会作出回应后,挂 - 和它的作用。此外,在思考的事实,它仍然更新屏幕,我把一个断点在油漆事件,并得到了一些(更多)的古怪行为。它打在内线活动的断点,而不是在该点的调用堆栈的顶部。调用堆栈的顶部显示人在睡眠时,等待或加入。然后在漆线旁边,那么外部code,那么主要的。因此,该行突出显示在屏幕上的绿色 - 不是黄色。此外,如果我F10(跨过),确实如此,向下移动正是1号线,但仍然疼痛的方法是不是在调用堆栈的顶部。在这一点上,没有其他线程运行,没有其他的code执行,没有别的事?!?!这是怎么回事吗?

In my last edit, I mentioned that it was not accepting IO anymore. This got me thinking so, I added a TcpListener to see if that would still respond after it "hung" - and it does. Additionally, in thinking about the fact that it still updates the screen, I put a breakpoint in the paint event and got some (more) odd behavior. It hits the breakpoint in the paint event, but is NOT at the top of the call stack at that point. The top of the callstack shows "In sleep, wait or join". Then the line in paint is next, then external code, then main. So the line highlighted on the screen is Green - not Yellow. Additionally, if I F10 (to step over), it does, moving down exactly 1 line, but still, the pain method is not at the top of the call stack. At this point, there are no other threads running, no other code executing, nothing else happening?!?! What is going on here?

最后一点 - 我在的TcpListener的接受插槽事件中设置一个断点,当我连接到TCP / IP端口,它打破上code,而code在的顶部调用堆栈。

One final point - I set a breakpoint in the TcpListener's Accept Socket event, and when I connect to the TCP/IP port, it breaks on that code, and that code IS at the top of the call stack.

抱歉 - 但我还是很困惑

Sorry - But I'm still quite confused.

推荐答案

您可以有控制有问题(或处理)对非UI线程创建的,<一个href="http://stackoverflow.com/questions/10436981/winforms-application-hang-due-to-systemevents-onuser$p$pferencechanged-event/11634388#11634388">check这个问题。

You may have a problem with control (or its handle) created on non UI thread, check this question.

这篇关于Application.Run(形式)吊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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