-
-
Notifications
You must be signed in to change notification settings - Fork 110
Closed
Description
Hi,
I updated to the latest TUnit version 0.56.5 and now my async [Before(Test)] hooks aren't working properly because they are not being awaited.
I have traced the error to the following line:
| writer.AppendLine("await AsyncConvert.ConvertObject(() => result);"); |
It seems to be trying to convert result to something that can be awaited but since it is passing in a local Func<object> then it will always end up running syncFunc() in AsyncConvert which isn't the intention.
TUnit/TUnit.Core/AsyncConvert.cs
Lines 65 to 69 in fcbe27a
| if (invoke is Func<object> syncFunc) | |
| { | |
| syncFunc(); | |
| return; | |
| } |
To be clear, the before hook is being called, but TUnit continues execution without waiting for the async operation to complete so tests end up running before the hook is done running.
Metadata
Metadata
Assignees
Labels
No labels