You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the normal pattern for handling unexpected exception in a background task is as follows:
catch-and-eat expected exception..
catch (Exception exception) // unexpected
{
Debug.Fail($"message with {exception}");
// if Debug.Fail is no-op, we want this task to complete with an unobserved exception
// that the UnobservedTaskException event can see
throw;
}
When a logger (see below) is available, we also log this exception between the Debug.Fail and the throw:
catch (Exception exception) // unexpected
{
Debug.Fail($"message with {exception}");
_logger.LogXxxFailed(exception); // at the error level
throw;
For "unexpected" exceptions thrown by application code (such as Payload.ReadAsync) during:
the sending of a response (including the payload continuation of the response)
the sending of a request payload continuation
that are not otherwise reported, we log them and "eat" them:
catch (Exception exception) // unexpected "application exception"
{
_logger.LogPayloadContinuationSendFailed(exception); // at the Debug level
// exception is handled/consumed
}
We also use this logger to log otherwise unreported failures such as:
failure to decode a request header (Debug level)
response header too large to send (Warning level)
failure to encode a response header field (Warning level)
bad flush result from pipe writer (Error level)
The text was updated successfully, but these errors were encountered:
I'm not fond of allowing to application to setup failure callbacks, in particular if there are alternatives such as setting up a payload writer to allow logging send failures.
This proposal replaces #2231.
remove
ConnectionOptions.FaultedTaskAction
the normal pattern for handling unexpected exception in a background task is as follows:
When a logger (see below) is available, we also log this exception between the Debug.Fail and the throw:
that are not otherwise reported, we log them and "eat" them:
We also use this logger to log otherwise unreported failures such as:
The text was updated successfully, but these errors were encountered: