From 26c22364d231981870e3ac88ab0df9e13bc1d0ed Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Mon, 17 May 2021 10:46:37 -0300 Subject: [PATCH] =?UTF-8?q?=E2=8C=9B=20When=20trying=20to=20attach=20to=20?= =?UTF-8?q?the=20IDE=20ActiveDocument,=20increase=20wait=20between=20retri?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #41 --- src/SmallSharp/MonitorActiveDocument.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SmallSharp/MonitorActiveDocument.cs b/src/SmallSharp/MonitorActiveDocument.cs index 14c058b..e52c19c 100644 --- a/src/SmallSharp/MonitorActiveDocument.cs +++ b/src/SmallSharp/MonitorActiveDocument.cs @@ -32,7 +32,7 @@ public override bool Execute() if (BuildEngine4.GetRegisteredTaskObject(nameof(ActiveDocumentMonitor), RegisteredTaskObjectLifetime.AppDomain) is not ActiveDocumentMonitor monitor) { var maxAttempts = 5; - for (var i = 0; i < maxAttempts; i++) + for (var i = 1; i <= maxAttempts; i++) { if (WindowsInterop.GetServiceProvider() is IServiceProvider services) { @@ -53,7 +53,8 @@ public override bool Execute() { Debug.WriteLine(e); } - Thread.Sleep(200); + // Increase the wait time to allow more time between retries + Thread.Sleep(200 * i); } }