Skip to content

Commit 26c2236

Browse files
committed
⌛ When trying to attach to the IDE ActiveDocument, increase wait between retries
Fixes #41
1 parent 979a36b commit 26c2236

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/SmallSharp/MonitorActiveDocument.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public override bool Execute()
3232
if (BuildEngine4.GetRegisteredTaskObject(nameof(ActiveDocumentMonitor), RegisteredTaskObjectLifetime.AppDomain) is not ActiveDocumentMonitor monitor)
3333
{
3434
var maxAttempts = 5;
35-
for (var i = 0; i < maxAttempts; i++)
35+
for (var i = 1; i <= maxAttempts; i++)
3636
{
3737
if (WindowsInterop.GetServiceProvider() is IServiceProvider services)
3838
{
@@ -53,7 +53,8 @@ public override bool Execute()
5353
{
5454
Debug.WriteLine(e);
5555
}
56-
Thread.Sleep(200);
56+
// Increase the wait time to allow more time between retries
57+
Thread.Sleep(200 * i);
5758
}
5859
}
5960

0 commit comments

Comments
 (0)