如何连接两个异常?

bev*_*qua 8 c# reflection exception-handling exception

我有以下代码用于处理我的Web应用程序中的异常:

application.Response.Clear();
application.Response.Status = Constants.HttpServerError;
application.Response.TrySkipIisCustomErrors = true;

LogApplicationException(application.Response, exception);
try
{
    WriteViewResponse(exception);
}
// now we're in trouble. lets be as graceful as possible.
catch (Exception exceptionWritingView)
{
    // Exception wrapper = ??
    WriteGracefulResponse(exceptionWritingView);
}
finally
{
    application.Server.ClearError();
}
Run Code Online (Sandbox Code Playgroud)

这里的问题是,如果在尝试将响应呈现为a时出现异常ViewResult,我将"抑制"原始异常(View无论如何),并仅显示导致错误ViewResult抛出的原因.

我想要两者exception并且两者都exceptionWritingView做一个例外,exceptionWritingView在顶部.

这将是:

exceptionWritingView
    -> inner exceptions of exceptionWritingView
            -> original exception that raised the unhandled exception handler
                       -> its inner exceptions
Run Code Online (Sandbox Code Playgroud)

但我不能InnerException在我的exception对象上设置属性.那我该怎么做呢?

在"最佳"我可以创建一个新的Exception使用new Exception(exceptionWritingView.Message, exception),但我会失去部分StackTrace我会失去任何加InnerExceptionS中exceptionWritingView可能已经有.

反思是唯一的出路吗?用反射做这件事会不会那么可怕?