Skip to content

When exceptions are rethrown with throw ex;, the original context (the stack) is lost #5

@lefth

Description

@lefth

When the exception is cached and throw; is not applicable, another technique is needed to preserve the original exception's context. Storing it as an InnerException is one way, but I think in this case, it's more useful to rethrow it without changing its context:

ExceptionDispatchInfo.Capture(ex).Throw();

A pull request is on the way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions