Skip to content

Commit

Permalink
Fix for reported issue #2769 (#2781)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelhasse authored Oct 9, 2024
1 parent d4275c4 commit 0844597
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,22 @@ public Task<T[]> ToArrayAsync<T>(IQueryable<T> queryable, CancellationToken canc

private async Task<TResult> ExecuteAsync<TResult>(Func<Task<TResult>> operation)
{
await _lock.WaitAsync();

try
{
return await operation();
await _lock.WaitAsync();

try
{
return await operation();
}
finally
{
_lock.Release();
}
}
finally
catch (ObjectDisposedException)
{
_lock.Release();
return default!;
}
}

Expand Down

0 comments on commit 0844597

Please sign in to comment.