生成.NET崩溃转储自动 [英] Generating .NET crash dumps automatically

查看:243
本文介绍了生成.NET崩溃转储自动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何生成故障转储文件ADPlus的或DebugDiag资料,但我不知道是否有办法做到这一点客户的计算机上没有安装这些工具......特别是,我想能够配置我的应用程序(使用注册表值,例如)来产生严重故障的情况下崩溃转储。更具体地讲,我需要能够从C#应用程序做到这一点,但我不介意P / Invoke'ing如果必要的。谢谢!

I know how to generate Crash Dump files with ADPlus or DebugDiag, but I'm wondering if there is a way to do this on a customer's computer without installing these tools... specifically, I would like to be able to configure my application (using a registry value, for example) to generate a crash dump in the case of a critical failure. More specifically, I need to be able to do this from a C# application, but I don't mind P/Invoke'ing if necessary. Thanks!

推荐答案

请注意,从里面的失败的过程创建转储(甚至线程)本身是不平凡的,也可能是不准确的(也的 MiniDumpWriteDump 功能的备注)。

Note that creating a minidump from inside the "failing" process (or even thread) itself is not trivial or might not be accurate (also MiniDumpWriteDump function's Remarks).

此外,如果你的程序是,你可能需要写一个崩溃转储这样的愤怒,整个情况通常如此大清洗,甚至试图创建一个崩溃转储可能会导致另一种崩溃(如挂起预留的情况下 - 但这些可能是更难从当前进程中的捕捉)。

Besides, if your process is in such anger that you might need to write a crash dump, the whole situation is typically so hosed, that even attempting to create a crash dump could cause another crash (situations like hangs aside - but those might be even harder to "catch" from within the current process).

最好的事情你可以做,如果你不能安装到客户端的系统独立的应用程序,是启动一个外部进程(也可以在紧急情况下失败!),并让这从当前进程创建一个故障转储(看<一href="https://web.archive.org/web/20090825040700/http://msdn.microsoft.com/en-us/magazine/cc188701.aspx"相对=nofollow> Superassert.NET从约翰·罗宾斯)。你甚至可以走那么远,才能把外部的二进制到您的应用程序资源,从那里提取它在启动时(以最大限度地节省关键situtations失败)磁盘(如果你敢)。

The "best" thing you can do, if you cannot install separate applications on your client's systems, is to start an external process (which could also fail in critical situations!) and let that create a crashdump from your current process (see Superassert.NET from John Robbins). You could even go so far, as to put the external binary into your app resources, extract it from there on startup (as to minimize failure in critical situtations) to disk (if you dare).

这篇关于生成.NET崩溃转储自动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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