Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Issue: Rethrow the exception loses the exception stack [864]

$
0
0
In our System.Web.Http.WebHost.HttpControllerHandler.EndProcessRequest(), we will rethrow some exception if task is fauled or cancelled. Unfortunately, this rethrow hides the original exception stack. We should consider preserving it, or at least trace it out.

/// <summary>
/// Provides an asynchronous process End method when the process ends.
/// </summary>
/// <param name="result">An <see cref="T:System.IAsyncResult"/> that contains information about the status of the process.</param>
protected virtual void EndProcessRequest(IAsyncResult result)
{
TaskWrapperAsyncResult asyncResult = (TaskWrapperAsyncResult)result;
Contract.Assert(asyncResult != null);
Task task = asyncResult.Task;

// Check task result and unwrap any exceptions
if (task.IsCanceled)
{
throw Error.OperationCanceled();
}
else if (task.IsFaulted)
{
throw task.Exception.GetBaseException();
}
}


Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>