From 69b591e5036d5e3ea54cf25f6e1164c6fe9ada7b Mon Sep 17 00:00:00 2001 From: Artur Kharin Date: Wed, 15 Oct 2025 10:39:41 +0300 Subject: [PATCH] Fixed self deadlock that hangs the application on icon fetch. --- src/UniGetUI.Core.Classes/TaskRecycler.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/UniGetUI.Core.Classes/TaskRecycler.cs b/src/UniGetUI.Core.Classes/TaskRecycler.cs index ec523c4f03..d6ec607ada 100644 --- a/src/UniGetUI.Core.Classes/TaskRecycler.cs +++ b/src/UniGetUI.Core.Classes/TaskRecycler.cs @@ -108,7 +108,7 @@ private static async Task _runTaskAndWait_VOID(Task task, int hash, int cacheTim { // Race condition, an equivalent task got added from another thread between the TryGetValue and TryAdd, // so we are going to restart the call to _runTaskAndWait in order for TryGetValue to return the new task again - await _runTaskAndWait_VOID(task, hash, cacheTimeSecsSecs); + await _runTaskAndWait_VOID(task, hash, cacheTimeSecsSecs).ConfigureAwait(false); return; } else @@ -118,7 +118,7 @@ private static async Task _runTaskAndWait_VOID(Task task, int hash, int cacheTim } // Wait for the task to finish - await task; + await task.ConfigureAwait(false); // Schedule the task for removal after the cache time expires _removeFromCache_VOID(hash, cacheTimeSecsSecs); @@ -138,7 +138,7 @@ private static async Task _runTaskAndWait(Task task, int hash, { // Race condition, an equivalent task got added from another thread between the TryGetValue and TryAdd, // so we are going to restart the call to _runTaskAndWait in order for TryGetValue to return the new task again - return await _runTaskAndWait(task, hash, cacheTimeSecsSecs); + return await _runTaskAndWait(task, hash, cacheTimeSecsSecs).ConfigureAwait(false); } else { @@ -147,7 +147,7 @@ private static async Task _runTaskAndWait(Task task, int hash, } // Wait for the task to finish - ReturnT result = await task; + ReturnT result = await task.ConfigureAwait(false); // Schedule the task for removal after the cache time expires _removeFromCache(hash, cacheTimeSecsSecs);