Skip to content

Commit

Permalink
Fix deadlock and spin wait thread starvation in integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Mar 1, 2018
1 parent dbdbc12 commit ad9c632
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ protected void SetUpEditor(string markupCode)
{
VisualStudio.Editor.SetText(code);
VisualStudio.Editor.MoveCaret(caretPosition);
VisualStudio.Editor.Activate();
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ public void Method(string b, int a) { }
}", actuaText);
}

[Fact(Skip = "https://github.com/dotnet/roslyn/issues/17680"),
Trait(Traits.Feature, Traits.Features.ChangeSignature)]
[Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)]
public void VerifyRemoveParameter()
{
SetUpEditor(@"
Expand Down Expand Up @@ -114,7 +113,7 @@ class C
/// A method.
/// </summary>
/// <param name=""a""></param>
///
///
public void Method(int a) { }
void Test()
Expand All @@ -124,8 +123,7 @@ void Test()
}", actuaText);
}

[Fact(Skip = "https://github.com/dotnet/roslyn/issues/17680"),
Trait(Traits.Feature, Traits.Features.ChangeSignature)]
[Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)]
public void VerifyCrossLanguageGlobalUndo()
{
SetUpEditor(@"using VBProject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public CSharpGenerateTypeDialog(VisualStudioInstanceFactory instanceFactory)
{
}

[Fact(Skip = "https://github.com/dotnet/roslyn/issues/21154"), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)]
public void OpenAndCloseDialog()
{
SetUpEditor(@"class C
Expand All @@ -42,7 +42,7 @@ void Method()
GenerateTypeDialog.VerifyClosed();
}

[Fact(Skip = "https://github.com/dotnet/roslyn/issues/21154"), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)]
public void CSharpToBasic()
{
var vbProj = new ProjectUtils.Project("VBProj");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public BasicGenerateTypeDialog(VisualStudioInstanceFactory instanceFactory)
{
}

[Fact(Skip = "https://github.com/dotnet/roslyn/issues/21154"), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)]
public void BasicToCSharp()
{
var csProj = new ProjectUtils.Project("CSProj");
Expand Down Expand Up @@ -68,7 +68,7 @@ public struct A
}", actualText);
}

[Fact(Skip = "https://github.com/dotnet/roslyn/issues/21154"), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)]
public void SameProject()
{
SetUpEditor(@"
Expand Down Expand Up @@ -107,8 +107,7 @@ End Class
", actualText);
}

[Fact(Skip = "https://github.com/dotnet/roslyn/issues/17680"),
Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)]
public void CheckFoldersPopulateComboBox()
{
var project = new ProjectUtils.Project(ProjectName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess
Expand Down Expand Up @@ -214,7 +215,7 @@ private void WaitForPredicate(Func<bool> predicate)
var beginTime = DateTime.UtcNow;
while (!predicate() && DateTime.UtcNow < beginTime.AddMilliseconds(_timeoutInMilliseconds))
{
Task.Delay(50);
Thread.Sleep(50);
}

if (!predicate())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public void CodeActions(
FixAllScope? fixAllScope = null,
bool blockUntilComplete = true)
{
// Wait for the light bulb to appear before forcing it to drop down, otherwise the UI thread can
// deadlock in SuggestedActionsSource.
_textViewWindow.WaitForLightBulbSession();
_textViewWindow.ShowLightBulb();
_textViewWindow.WaitForLightBulbSession();

Expand Down

0 comments on commit ad9c632

Please sign in to comment.