private ExceptionDispatchInfo SetException(Exception e)
{
Debug.Assert(e != null, $"Expected non-null Exception to be passed to {nameof(SetException)}");
if (_exception == null)
{
_exception = ExceptionDispatchInfo.Capture(e);
}
if (_exception != null && Context != null)
{
Context.Close();
}
return _exception;
}