Skip to content

Commit

Permalink
Merge pull request #57312 from CyrusNajmabadi/ciDiags
Browse files Browse the repository at this point in the history
Add diags to help us diagnose lightbulb issues better
  • Loading branch information
CyrusNajmabadi authored Oct 26, 2021
2 parents adf1456 + 06c9b7f commit 5d3f6c7
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ public static async Task<IEnumerable<SuggestedActionSet>> WaitForItemsAsync(ILig
if (activeSession == null)
{
var bufferType = view.TextBuffer.ContentType.DisplayName;
throw new InvalidOperationException(string.Format("No expanded light bulb session found after View.ShowSmartTag. Buffer content type={0}", bufferType));
throw new InvalidOperationException($"No expanded light bulb session found after View.ShowSmartTag. Buffer content type={bufferType}");
}

var start = DateTime.Now;
IEnumerable<SuggestedActionSet> actionSets = Array.Empty<SuggestedActionSet>();
while (DateTime.Now - start < Helper.HangMitigatingTimeout)
{
var status = activeSession.TryGetSuggestedActionSets(out actionSets);
var status = activeSession.TryGetSuggestedActionSets(out var actionSets);
if (status is not QuerySuggestedActionCompletionStatus.Completed and
not QuerySuggestedActionCompletionStatus.Canceled)
{
Expand All @@ -64,12 +63,12 @@ public static async Task<IEnumerable<SuggestedActionSet>> WaitForItemsAsync(ILig
}

if (status != QuerySuggestedActionCompletionStatus.Completed)
actionSets = Array.Empty<SuggestedActionSet>();
throw new InvalidOperationException($"Querying light bulb for status produced: {status}");

break;
return actionSets;
}

return actionSets;
throw new InvalidOperationException($"Light bulb never transitioned to completed state.");
}
}
}

0 comments on commit 5d3f6c7

Please sign in to comment.