Skip to content

Commit

Permalink
Merge remote-tracking branch 'sharwell/wait-for-compilation' into tes…
Browse files Browse the repository at this point in the history
…tfix
  • Loading branch information
genlu committed Nov 9, 2023
2 parents eba055a + ede124b commit 5e7f3b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
Expand Down Expand Up @@ -95,6 +94,8 @@ protected async Task SetUpEditorAsync(string markupCode, CancellationToken cance
{
await TestServices.Workspace.SetPrettyListingAsync(LanguageName, originalValue, cancellationToken);
}

await TestServices.Workarounds.WaitForCompilationAvailableAsync(cancellationToken);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Extensibility.Testing;
using Microsoft.VisualStudio.LanguageServices;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;

Expand All @@ -17,6 +18,17 @@ namespace Roslyn.VisualStudio.IntegrationTests.InProcess
[TestService]
internal partial class WorkaroundsInProcess
{
public async Task WaitForCompilationAvailableAsync(CancellationToken cancellationToken)
{
await TestServices.Workspace.WaitForAsyncOperationsAsync(FeatureAttribute.Workspace, cancellationToken);

var workspace = await TestServices.Shell.GetComponentModelServiceAsync<VisualStudioWorkspace>(cancellationToken);
foreach (var project in workspace.CurrentSolution.Projects)
{
await project.GetCompilationAsync(cancellationToken);
}
}

public async Task WaitForNavigationAsync(CancellationToken cancellationToken)
{
await TestServices.Workspace.WaitForAllAsyncOperationsAsync([FeatureAttribute.Workspace, FeatureAttribute.NavigateTo], cancellationToken);
Expand Down

0 comments on commit 5e7f3b3

Please sign in to comment.