Ok, the problem is this - plenty of code, many times called, probability of
raising exception is about 1e-5.

From many reasons is not possible to serialize params into string just
for the case that exception would be raised.

Is there possible to save *values* of params *generically* just from the exception
raised?

Please no reflection based attempts - it is *not* possible - only debugging API can
do the trick, but how ???

Thanks for any ideas!

Recommended Answers

All 2 Replies

public void MyMethod(SomeType param1, SomeType param2) {
    try {
        // some code that sometimes errors
    } catch (Exception e) {
        // log exception and parameters here
    }
}

Is this what you mean? Your explanation isn't very clear as you claim that reflection doesn't work.

you could use the output window to display what your prams are before calling.
System.Diagnostics.Trace.WriteLine()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.