How can we take minidump during exceptions
I am working on a sub project(.NET) which deals with exceptions. Below is my requirement
When an exception occurs, the exception assembly must capture
- CPU information
- Method which caused the issue
- Data which caused the issue
- Environment details (path and other information)
In a开发者_如何学Cbove all these, the toughest part would be getting the data which caused the issue.
The data could be stored anywhere within the method body. it could be method parameters, local variables, objects etc. I believe there is no interface available in .Net which can expose the data in the memory at the time of exception. so I was thinking of taking mini dumps during the exception. Is it possible in .Net to create mini dumps.
my software env is. .Net 3.5, WCF, Silverlight
do pass me some links.
thanks
I wrote a managed console app that calls the native API for creating minidumps. I posted it here: Complete Minidump code
It is actually rather easy. The hardest part really, is just determining what name you want to name your minidump file.
Debugger support for managed code dumps created via the methods described in other answers is (or was) limited - see @Jaredpar's info here.
Supposedly Visual Studio 2010 supports this though, per info here.
The Visual Studio 2010 debugger can read dump files that contain information about managed code, unmanaged code, or a mixture of both. You can debug both native and managed dumps using the normal debugging windows.
FYI you can set up Process Dumper to trigger process dump on selected native exceptions - not sure how this works in a managed process though. fwiw I see no reason why a native exception would not trigger the dump just the same since it's happening outside the scope of the CLR (in native code stackframe), nor why such a dump could not be handled in VS2010.
You can use PInvoke to call the Windows API to create minidumps.
How to create minidump for my process when it crashes?
http://msdn.microsoft.com/en-us/library/ms680360(v=VS.85).aspx
精彩评论