调试 C# GUI
概述: 我正在调试一个 C# GUI,它接收 XML 文件并启动一个新进程来对 XML 文件执行统计计算。由于某种原因,该进程在执行过程中退出,没有明显的错误。出现一个 Windows 消息框并显示“已停止工作,Windows 正在寻找解决方案”
我尝试过的操作:
- 我尝试写入日志以跟踪 执行应用程序,这样我就可以 看看哪里失败了,但是过程 似乎在不同点退出 程序。
- 我尝试使用视觉工作室 调试器跟踪程序 执行,但类似
进程在不同时间退出。
我想知道:
- 我还有其他免费的调试器吗? 可以尝试吗?
- 我可以打电话看看吗 进程的当前状态 当它运行时?
- 有人能想到还有什么可以尝试的吗?
任何帮助都会很棒。 谢谢。
Overview:
I am debugging a C# GUI that takes in an XML file and starts a new Process to perform statistical calculations on the XML file. The process for some reason is exiting in the middle of execution with no apparent errors. A windows message box appears and says " has stopped worked, Windows is searching for a solution"
What I've tried:
- I tried writing to a log to trace the
execution of the application so I can
see where it fails, but the process
seems to exit at different points in
the program. - I tried using Visual studios
debugger to follow the program
execution, but similarly the
process exits at different times.
What I'd like to know:
- Are there any other free debuggers I
could try? - Are there any calls I can make to see
the current state of the process
while it's running? - Can anyone think of anything else to try?
any help would be great.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Visual Studio 的调试器是有史以来最好的调试工具,您应该更多地关注学习使用它而不是寻找其他任何东西。
要回答您的问题,请转到
调试>异常
(CTRL+D CTRL+E),然后勾选公共语言运行时异常
旁边的抛出
框。这将导致调试器在抛出异常时中断,无论您是悄悄地接受它还是完全忽略它。这应该有助于查明您的问题。Visual Studio's debugger is the best debugging tool ever written, you should focus more on learning to use it than looking for anything else.
To answer your question, go to
Debug>Exceptions
(CTRL+D CTRL+E) and tick theThrown
box next toCommon Language Runtime Exceptions
. This will cause the debugger to break whenever an exception is being thrown, regardless if you quietly swallow it or completely ignore it. This should help pinpoint your problem.在代码中的战略点添加一些
语句以强制您进入调试器可能是解决此类问题的有用方法......
只是不要忘记将它们删除!
Adding some
statements at strategic points in your code to force you into the debugger can be a useful way to troubleshoot stuff like this...
Just don't forget to take them out!
您可以注册
AppDomain.CurrentDomain
UnhandledException
事件来查看是否捕获您的问题。在显示主窗体之前,在 Program.cs 文件中添加类似的内容:
另一种选择是通过 WinDbg
You could register for the
AppDomain.CurrentDomain
UnhandledException
event to see if catches your problem.Adding something like this in your Program.cs file before the main form is shown:
Another option would be to run your application through WinDbg