Steps which return tasks that never complete, are never completed - adamralph/xbehave.net GitHub Wiki

This problem occurs when a step contains an expression which returns a Task which will never be completed.

For example, an expression which assigns a Task variable will return that Task:

"Given a task"
    .x(() => task = new Task(() => { }));

When the step is executed, xBehave.net will await the Task before executing the next step. Because the Task never completes, the step will never complete.

The workaround is to use a block instead of an expression:

"Given a task"
    .x(() =>
    {
        task = new Task(() => { })
    });