CrossThreadRunner.ThrowExceptionPreservingStack C# (CSharp) Method

ThrowExceptionPreservingStack() private method

private ThrowExceptionPreservingStack ( Exception exception ) : void
exception Exception
return void
    static void ThrowExceptionPreservingStack(Exception exception)
    {
        var remoteStackTraceString = typeof(Exception).GetField("_remoteStackTraceString", BindingFlags.Instance | BindingFlags.NonPublic);
        remoteStackTraceString.SetValue(exception, exception.StackTrace + Environment.NewLine);
        throw exception;
    }