Esempio n. 1
0
        internal static void writeObject(Exception x, ObjectOutputStream s)
        {
#if !FIRST_PASS
            lock (x)
            {
                ObjectOutputStream.PutField fields = s.putFields();
                Throwable _thisJava = x as Throwable;
                if (_thisJava == null)
                {
                    fields.put("detailMessage", x.Message);
                    fields.put("cause", x.InnerException);
                    // suppressed exceptions are not supported on CLR exceptions
                    fields.put("suppressedExceptions", null);
                    fields.put("stackTrace", getOurStackTrace(x));
                }
                else
                {
                    fields.put("detailMessage", _thisJava.detailMessage);
                    fields.put("cause", _thisJava.cause);
                    fields.put("suppressedExceptions", _thisJava.suppressedExceptions);
                    getOurStackTrace(x);
                    fields.put("stackTrace", _thisJava.stackTrace ?? java.lang.ThrowableHelper.SentinelHolder.STACK_TRACE_SENTINEL);
                }
                s.writeFields();
            }
#endif
        }
Esempio n. 2
0
        internal static void writeObject(Exception x, ObjectOutputStream s)
        {
#if !FIRST_PASS
            lock (x)
            {
                ObjectOutputStream.PutField fields = s.putFields();
                fields.put("detailMessage", Throwable.instancehelper_getMessage(x));
                Exception cause = Throwable.instancehelper_getCause(x);
                if (cause == null && x is Throwable)
                {
                    cause = ((Throwable)x).cause;
                }
                fields.put("cause", cause);
                fields.put("stackTrace", Throwable.instancehelper_getStackTrace(x));
                s.writeFields();
            }
#endif
        }