I have a unhandled exception handler (an oxymoron if ever there was one) but I'd like to get more information out of it.
At the moment it logs the exception message, stack trace etc. and recursively does the same for any inner exceptions. However often the exception is a derived type of the exception class and therefore I do not know ahead of time what it will look like. So what I would like is some code to use reflection to output all of the primitive fields and properties to a text file as name/value pairs and then do the same for any non-primitive objects in the object graph recursively.
I had a go at doing this myself but quickly realised I'd have to deal with collections etc. and someone must have done this before. Another option might be to use serialisation I suppose.
Has anyone done this before? Any code out there?