Skip to content

NHibernate.Engine.ActionQueue.ExecuteAsync hides TaskCanceledException #3592

Open
@Madajevas

Description

@Madajevas

If provided cancellation token gets cancelled during execution of InnerExecuteAsync method and any listener code checks token and throws exception it gets lost because regardless of cancellation token state finally block gets executed where PreInvalidateCachesAsync method checks token again and throws exception of its own. I would advice to not call that method if cancellation was requested and allow exception to bubble.

public async Task ExecuteAsync(IExecutable executable, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
try
{
await (InnerExecuteAsync(executable, cancellationToken)).ConfigureAwait(false);
}
finally
{
await (PreInvalidateCachesAsync(cancellationToken)).ConfigureAwait(false);
}
}

Metadata

Metadata

Assignees

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