1 using System.Diagnostics;
3 namespace System.Runtime.Serialization {
5 internal static class DiagnosticUtility {
6 internal static bool ShouldTraceError = true;
7 internal static bool ShouldTraceWarning;
8 internal static bool ShouldTraceInformation;
9 internal static bool ShouldTraceVerbose = true;
11 internal static class DiagnosticTrace {
12 internal static void TraceEvent (params object [] args)
18 internal static class ExceptionUtility {
19 internal static Exception ThrowHelperError (Exception e)
21 return ThrowHelper (e, TraceEventType.Error);
24 internal static Exception ThrowHelperCallback (string msg, Exception e)
26 return new CallbackException (msg, e);
29 internal static Exception ThrowHelperCallback (Exception e)
31 return new CallbackException ("Callback exception", e);
34 internal static Exception ThrowHelper (Exception e, TraceEventType type)
39 internal static Exception ThrowHelperArgument (string arg)
41 return new ArgumentException (arg);
44 internal static Exception ThrowHelperArgument (string arg, string message)
46 return new ArgumentException (message, arg);
49 internal static Exception ThrowHelperArgumentNull (string arg)
51 return new ArgumentNullException (arg);
54 internal static Exception ThrowHelperFatal (string msg, Exception e)
56 return new FatalException (msg, e);