为什么在调试时 Word 会冻结?
每当我在 Visual Studio 2008 中的某个 C#.NET 应用程序中遇到断点并启动 Microsoft Word 2007 时,Word 将无法打开,直到我重新启动 C# 应用程序。 我有一些关于原因的理论,但有人确切知道吗?
Whenever I'm at a break point in a certain C#.NET application in Visual Studio 2008 and I fire up Microsoft Word 2007, word will fail to open until I restart the C# application. I have a few theories about why, but does anyone know for sure?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能是因为 Word 正在向顶级窗口发送 DDE 消息,而您的应用程序无法处理它,因为它挂在调试器中。 Raymond Chen 有一篇关于此的博客文章(尽管与调试器没有直接关系,但效果相同)。
This can be because Word is sending out DDE messages to top level windows, and your app is not able to process it since it is hung in the debugger. Raymond Chen has a blog post on this (though not directly related to debugger, but same effect).
此类挂起的常见原因是(或曾经是)应用程序在启动时发送广播 Windows 消息并期望每个窗口都有响应。 如果您在调试器中打开了 GUI 应用程序,那么它不会回复 Windows 消息,因此发送应用程序将挂起等待响应。 我记得使用这种技术的最常见的程序类型是安装程序。
我不知道 Word 2007 是否发送任何广播消息,但这只是可能发生的一种方式。 COM/OLE 内容可能会通过多种方式挂起,对于 Word 来说,这种情况似乎更可能发生。
A common cause of such hangs is (or used to be) an application that sent a broadcast Windows message on startup and expected a response from every window. If you've got a GUI application open in a debugger, then it won't be replying to Windows messages and so the sending application will hang waiting for a response. I recall the most common types of programs that used this technique were installer programs.
I don't know whether Word 2007 sends any broadcast messages, but that's only one way this might happen. There are a myriad ways that COM/OLE stuff can get hung up, and this probably seems more likely for Word.