WPF - 处理未处理的异常时要捕获哪些信息?
我正在 WPF / .Net 3.5 中开发一个应用程序,可以在互联网上下载。我 - 尽我所能 - 编写无错误的代码,并且仅在必要时使用异常。然而,我的软件开发经验表明,用户总是设法做一些奇怪的事情,从而导致以一种你无法想象的方式抛出异常。当我必须捕获未处理的异常时,我想收集更多信息。到目前为止,我正在捕获以下内容:
- 标准异常字段(消息、类型、堆栈跟踪等)
- 操作系统版本
- .Net 版本
- 加载到 AppDomain 中的应用程序 DLL 的版本
- 应用程序许可证信息
- 用户执行的最后几个命令的检测。
我非常清楚我不想捕获有关用户的任何“个人”信息,因为我只是不相信这类事情。因此,不必担心用户名/域/IP 地址(尽管由于异常信息被传递到网络服务,我本质上会获取 IP 信息,但它可能是代理计算机的)。
我的问题
任何将应用程序发布到公共领域(即发布到不在受控企业环境中的计算机上)的人 - 您能提出任何其他有助于追踪错误原因的建议吗?
特别是我不想收集我无法管理/编码的信息 - 即 PC 上可用的内存量或连接的打印机类型 - 这些东西是由 .net 框架处理的,我不应该真的 (阅读:不想)必须更改我的代码以应对外面的变化!
谢谢!
I am developing an application in WPF / .Net 3.5 that will be available for download on the internet. I am - to the best of my ability - writing bug free code, and using exceptions only where necessary. However my experience with software development has shown that users always manage to do something strange which causes an exception to be thrown in a way you could never imagined possible. I would like to gather additional information when I have to catch an unhandled exception. So far I am capturing the following:
- Standard Exception fields (message, type, stacktrace etc)
- OS Version
- .Net version
- Versions of the Applications DLLs loaded into the AppDomain
- App licence information
- Instrumentation of the last few commands executed by the user.
I am very concious that I do not want to capture any 'personal' information about the user as I just don't believe in that sort of thing. Hence not bothering with the username/domain/ip address (although as the exception information is delivered to a webservice I will inherently get ip information but it may be of a proxy machine).
My Question
Anyone who has released an application into the public domain (i.e. onto computers not in a controlled corporate environment) - can you suggest anything else that would be useful in tracking down the causes of errors?
Particularly I do not want to collect information that I cannot manage/code for - I.e. the amount of memory available on the PC, or type of printers attached - These things are handled by the .net framework and I shouldn't really (read: don't want to) have to alter my code to cope with the variations out there!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这应该足够了。您拥有有关环境、用户尝试执行的操作以及最重要的调试工具之一的信息:堆栈跟踪。
除非您正在谈论打印机管理应用程序或其他东西,否则打印机信息不值得。
您总是有可能会遇到由硬件、正在运行的服务、已安装的应用程序和月相的奇怪组合导致的错误。我认为仅仅为了处理这些罕见的错误而疯狂地收集有关用户环境的信息是不值得的。
只要记住有一种可以联系您获取错误报告的方式,以防用户确实需要解决他的特定问题,以便他可以提供有关该问题的更多信息并帮助您重现该问题。根据您的目标受众,您必须在错误跟踪器或简单的电子邮件地址之类的东西之间做出决定。
I think that should be enough. You have information about the environment, what the user was trying to do, and one of the most important debugging tools: the stack trace.
Unless you are talking about a printer management application or something, then printer information would not be worth it.
There is always that remote chance that you will encounter an error that results from a strange combination of hardware, running services, installed applications and moon phase. I don't think it is worth to rabidly collect information about the user environment just to deal with those rare errors.
Just remember to have a way that you can be contacted for bug reports, in case a user really needs his particular problem fixed, so that he can provide more information about it and help you reproduce it. Depending on your target audience you have to decide between something like a bug tracker or a simple e-mail address.