mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-09-01 19:51:34 +02:00
Fix gallery cancellation after concurrent refresh
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b34be394-240f-4bdd-878f-41460bc09c36
This commit is contained in:
@@ -254,6 +254,12 @@ public sealed partial class JsonRpcExtensionService : IExtensionService, IJsExte
|
||||
{
|
||||
RaiseProviderAdded(wrapper);
|
||||
}
|
||||
|
||||
if (timeoutCts.IsCancellationRequested)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
|
||||
@@ -182,6 +182,20 @@ public class JsonRpcExtensionServiceReconciliationTests
|
||||
Assert.IsNull(manifest);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task RefreshAndAwaitProviderAsync_CallerCancellation_Throws()
|
||||
{
|
||||
using var service = new JsonRpcExtensionService(TaskScheduler.Default);
|
||||
using var cancellationTokenSource = new CancellationTokenSource();
|
||||
cancellationTokenSource.Cancel();
|
||||
|
||||
await Assert.ThrowsExactlyAsync<OperationCanceledException>(() =>
|
||||
service.RefreshAndAwaitProviderAsync(
|
||||
Path.Combine(_root, "missing"),
|
||||
TimeSpan.FromSeconds(1),
|
||||
cancellationTokenSource.Token));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetExtensionDirectoryForPath_ReturnsOwningTopLevelDirectory()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user