-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
This issue seems to be very similar to this issue:
InternalExpectAsync does not await actionAsync() - causing actionAsync to run as a detached task #5537
Repro:
This is my code:
protected async Task ExpectLogNoWarningsNorErrorsAsync(Func<Task> action)
{
await CreateEventFilter(Sys)
.Custom(CustomErrorOrWarningFilter)
.ExpectAsync(0, TimeSpan.FromSeconds(3),
async () =>
{
await action();
});
}Invokes this code:
/// <summary>
/// Async version of <see cref="Intercept{T}"/>
/// </summary>
protected Task<T> InterceptAsync<T>(Func<T> func, ActorSystem system, TimeSpan? timeout, int? expectedOccurrences, MatchedEventHandler matchedEventHandler = null)
{
return InterceptAsync(() => Task.FromResult(func()), system, timeout, expectedOccurrences, matchedEventHandler);
}Which seems to invoke:
func()
without awaiting it, hence causing func() to run as a detached task.
Originally posted by @brah-mcdude in #5537 (comment)
Metadata
Metadata
Assignees
Labels
akka-testkitAkka.NET Testkit issuesAkka.NET Testkit issues