1

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

  1. CPU information
  2. Method which caused the issue
  3. Data which caused the issue
  4. Environment details (path and other information)

In above 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

mikerobi
  • 20,527
  • 5
  • 46
  • 42
  • Not to be rude, but who came up with those requirements? Never have I had an exception and thought, "Gosh, if only I had information about the current state of the CPU and all the Environment variables I'd have this bug licked!" –  Sep 27 '10 at 18:37
  • 4
    Sigh... I hate it when people start stating requirements in their SO questions. It almost feels like they're handing out assignments. I come here to get away from requirements for a minute. –  Sep 27 '10 at 18:38
  • @jdv, A requirement will contain a lot of things but what we ask here could be a small piece of it which we don't know how to proceed to start. It is not we hand out our requirements but at the same time we are not asking others to complete. a tip of like some link would be beneficial for us to understand. – Albert Arul prakash Sep 27 '10 at 18:58
  • @Bepenfriends: No hard feelings, I understand. Just avoid the term here. –  Sep 27 '10 at 19:11
  • Guys, I am looking for an idea which can be implemented at production env. A debugger (VS/processdump/debugdiags etc) might not be possible in a production environment. – Albert Arul prakash Sep 27 '10 at 19:56
  • @BepenFriends: getting a process dump is possible in a production environment, and once you have a dump you can debug it anywhere you like. If you need to get states of local variables and the like for debugging, a dump is probably your friend. Finding a generic way to pick up on local variables/parameters at runtime is likely to be painful... – Dan Puzey Jan 14 '11 at 08:28

3 Answers3

1

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.

C.J.
  • 15,637
  • 9
  • 61
  • 77
1

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.

Community
  • 1
  • 1
Steve Townsend
  • 53,498
  • 9
  • 91
  • 140
0

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

Community
  • 1
  • 1
cleek
  • 874
  • 8
  • 15