System.Exception.PrepForRemoting C# (CSharp) Method

PrepForRemoting() private method

private PrepForRemoting ( ) : Exception
return Exception
        internal Exception PrepForRemoting()
        {
            String tmp = null;

            if (_remoteStackIndex == 0)
            {
                tmp = Environment.NewLine+ "Server stack trace: " + Environment.NewLine
                    + StackTrace 
                    + Environment.NewLine + Environment.NewLine 
                    + "Exception rethrown at ["+_remoteStackIndex+"]: " + Environment.NewLine;
            }
            else
            {
                tmp = StackTrace 
                    + Environment.NewLine + Environment.NewLine 
                    + "Exception rethrown at ["+_remoteStackIndex+"]: " + Environment.NewLine;
            }

            _remoteStackTraceString = tmp;
            _remoteStackIndex++;
            return this;
        }
    

Usage Example

Example #1
0
        private Lazy <T> .Boxed CreateValue()
        {
            Lazy <T> .Boxed      result = null;
            LazyThreadSafetyMode mode   = this.Mode;

            if (this.m_valueFactory != null)
            {
                try
                {
                    if (mode != LazyThreadSafetyMode.PublicationOnly && this.m_valueFactory == Lazy <T> .PUBLICATION_ONLY_OR_ALREADY_INITIALIZED)
                    {
                        throw new InvalidOperationException(Environment.GetResourceString("Lazy_Value_RecursiveCallsToValue"));
                    }
                    Func <T> valueFactory = this.m_valueFactory;
                    if (mode != LazyThreadSafetyMode.PublicationOnly)
                    {
                        this.m_valueFactory = Lazy <T> .PUBLICATION_ONLY_OR_ALREADY_INITIALIZED;
                    }
                    result = new Lazy <T> .Boxed(valueFactory());

                    return(result);
                }
                catch (Exception arg_5B_0)
                {
                    Exception exception = arg_5B_0;
                    if (mode != LazyThreadSafetyMode.PublicationOnly)
                    {
                        this.m_boxed = new Lazy <T> .LazyInternalExceptionHolder(exception.PrepForRemoting());
                    }
                    throw;
                }
            }
            try
            {
                result = new Lazy <T> .Boxed((T)Activator.CreateInstance(typeof(T)));
            }
            catch (MissingMethodException)
            {
                Exception exception2 = new MissingMemberException(Environment.GetResourceString("Lazy_CreateValue_NoParameterlessCtorForT"));
                if (mode != LazyThreadSafetyMode.PublicationOnly)
                {
                    this.m_boxed = new Lazy <T> .LazyInternalExceptionHolder(exception2);
                }
                throw exception2;
            }
            return(result);
        }