I have an exception that I need to swallow (exception during logging), however I dont want the exception information to be completely lost to the mists of time and so I figured I may as well at least output it to debug using
Debug.Write(ex.ToString());
That way if it becomes necessary support can at least use DebugView on the machine having problems.
Trouble is the Debug class is removed in release mode - how do I output something to debug whilst in release mode?
Simply use
Trace.Write(ex.ToString());
This does the same as Debug.Write(ex.ToString());
but won't be removed in Release mode (as long as you didn't remove the definition of the TRACE constant in your project settings)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With