Skip to content

[BUG]: Command ExecuteAsync does not forward CancelationToken #65

@MattEdwardsWaggleBee

Description

@MattEdwardsWaggleBee

Current Behavior

The cancellation token should be forwarded to the context.

public virtual async Task<CommandResult> ExecuteAsync( TStart argument, CancellationToken cancellation = default )
    {
        var context = ContextFactory.Create( Logger ); // Here is the bug.

        await Pipeline.Value( context, argument ).ConfigureAwait( false );

        return new CommandResult
        {
            Context = context,
            CommandType = GetType()
        };
    }

Expected Behavior

Should forward it.

public virtual async Task<CommandResult> ExecuteAsync( TStart argument, CancellationToken cancellation = default )
    {
        var context = ContextFactory.Create( Logger, cancellation );

        await Pipeline.Value( context, argument ).ConfigureAwait( false );

        return new CommandResult
        {
            Context = context,
            CommandType = GetType()
        };
    }

Steps To Reproduce

  1. Pass a token and see that a new one is made

Anything else?

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions