对于我的 WPF/C# 3.5 客户端应用程序来说,什么是运行时错误报告的好方法?
我考虑过编写一个服务方法,在 try/catch 的 catch 块中调用该方法,将错误详细信息写入表中以供查看。然后我想到如果服务出现故障,客户端应用程序将无法报告这些数据。这让我想到弹出一个包含异常详细信息和复制按钮的文本框。用户可以单击复制按钮来复制文本并将其粘贴到发给我们支持小组的电子邮件中。
这听起来可能很粗糙,但我是客户端应用程序开发的新手,直到现在才真正考虑过这一点。
I've thought of writing a service method that I'd call within the catch block of a try/catch that writes error details to a table for viewing. Then I thought about if the services went down, the client app would have no way of reporting this data. This lead me to the thought of popping up a text box containing the exception details and a Copy button. The user would click the copy button to copy the text and paste it into an email to our support group.
It may sound crude, but I am new to client app development and haven't really given this much thought until now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
Application.DispatcherUnhandledException 事件
。请参阅此问题了解摘要(请参阅 Drew Noakes 的回答)。请注意,仍然会出现阻止应用程序成功恢复的异常情况,例如在尝试保存到数据库时堆栈溢出、内存耗尽或网络连接丢失。
Use the
Application.DispatcherUnhandledException Event
. See this question for a summary (see Drew Noakes answer).Be aware that there'll be still exceptions which preclude a successful resuming of your application, like after a stack overflow, exhausted memory or lost network connectivity while you're trying to save to the database.