Skip to content

WebApi skips ExceptionLogger on TaskCanceledException even if it's not associated with the request's CancellationToken #62

@j2jensen

Description

@j2jensen

It makes sense that you skip invoking ExceptionLoggers when the client cancels a request. However, TaskCanceledExceptions can sometimes be thrown that were not due to the client cancelling a request. Ignoring these cases can cause crucial exception information to be lost and unlogged.

Ideally, you should be able to check whether the CancellationToken on the TaskCanceledException is the same as the one passed into the controller action, and only skip logging if it is. Or, alternatively, you could at least check to see whether the token associated with the request had cancellation requested (via IsCancellationRequested). But please don't just ignore all TaskCanceledExceptions indiscriminately.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions