Skip to content

Commit

Permalink
Re-enabled tests previously skipped with message 'Crash with Abandone…
Browse files Browse the repository at this point in the history
…dMutexException'
  • Loading branch information
Ricardo Bossan (BEYONDSOFT CONSULTING INC) (from Dev Box) committed Dec 31, 2024
1 parent 0ce1218 commit 4b05a67
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.DotNet.RemoteExecutor;
using static System.Windows.Forms.Application;

namespace System.Windows.Forms.Tests;

public class ParkingWindowTests
{
[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public void ParkingWindow_DoesNotThrowOnGarbageCollecting()
{
using RemoteInvokeHandle invokerHandle = RemoteExecutor.Invoke(() =>
Task.Run(() =>
{
Control.CheckForIllegalCrossThreadCalls = true;

Expand All @@ -28,10 +27,7 @@ public void ParkingWindow_DoesNotThrowOnGarbageCollecting()
{
Assert.True(ex is null, $"Expected no exception, but got: {ex.Message}"); // Actually need to check whether GC.Collect() does not throw exception.
}
});

// verify the remote process succeeded
Assert.Equal(RemoteExecutor.SuccessExitCode, invokerHandle.ExitCode);
}).Wait();
}

private static Form InitFormWithControlToGarbageCollect()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void Application_CurrentCulture_SetNull_ThrowsArgumentNullException()
Assert.Throws<ArgumentNullException>("value", () => Application.CurrentCulture = null);
}

[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public void Application_EnableVisualStyles_InvokeBeforeGettingRenderWithVisualStyles_Success()
{
RemoteExecutor.Invoke(() =>
Expand All @@ -83,7 +83,7 @@ public void Application_EnableVisualStyles_InvokeBeforeGettingRenderWithVisualSt
}).Dispose();
}

[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public void Application_EnableVisualStyles_InvokeAfterGettingRenderWithVisualStyles_Success()
{
// This is not a recommended scenario per
Expand Down Expand Up @@ -115,7 +115,7 @@ public void Application_VisualStyleState_Get_ReturnsExpected()
Assert.Equal(state, Application.VisualStyleState);
}

[WinFormsTheory(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsTheory]
[EnumData<VisualStyleState>]
[InvalidEnumData<VisualStyleState>]
public void Application_VisualStyleState_Set_ReturnsExpected(VisualStyleState valueParam)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void ShowDialog_NonControlOwner_ReturnsExpected(bool runDialogResult, Dia
Assert.Equal(expectedDialogResult, dialog.ShowDialog(owner.Object));
}

[WinFormsTheory(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsTheory]
[InlineData(true, DialogResult.OK)]
[InlineData(false, DialogResult.Cancel)]
public void ShowDialog_NonControlOwnerWithVisualStyles_ReturnsExpected(bool runDialogResultParam, DialogResult expectedDialogResultParam)
Expand Down Expand Up @@ -154,7 +154,7 @@ public void ShowDialog_ControlOwner_ReturnsExpected(bool runDialogResult, Dialog
Assert.Equal(expectedDialogResult, dialog.ShowDialog(owner));
}

[WinFormsTheory(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsTheory]
[InlineData(true, DialogResult.OK)]
[InlineData(false, DialogResult.Cancel)]
public void ShowDialog_ControlOwnerWithVisualStyles_ReturnsExpected(bool runDialogResultParam, DialogResult expectedDialogResultParam)
Expand Down Expand Up @@ -190,7 +190,7 @@ public void ShowDialog_ControlOwnerWithHandle_ReturnsExpected(bool runDialogResu
Assert.Equal(expectedDialogResult, dialog.ShowDialog(owner));
}

[WinFormsTheory(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsTheory]
[InlineData(true, DialogResult.OK)]
[InlineData(false, DialogResult.Cancel)]
public void ShowDialog_ControlOwnerWithHandleWithVisualStyles_ReturnsExpected(bool runDialogResultParam, DialogResult expectedDialogResultParam)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3859,7 +3859,7 @@ public static IEnumerable<object[]> MouseDownUnsharesRow_WithDataGridView_TestDa
}
}

[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public void DataGridViewHeaderCell_MouseDownUnsharesRow_InvokeWithDataGridView_ReturnsExpected()
{
// Run this from another thread as we call Application.EnableVisualStyles.
Expand Down Expand Up @@ -4009,7 +4009,7 @@ public static IEnumerable<object[]> MouseLeaveUnsharesRow_WithDataGridViewMouseD
yield return new object[] { false, 1, ButtonState.Normal };
}

[WinFormsTheory(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsTheory]
[MemberData(nameof(MouseLeaveUnsharesRow_WithDataGridViewMouseDown_TestData))]
public void DataGridViewHeaderCell_MouseLeaveUnsharesRow_InvokeWithDataGridViewMouseDown_ReturnsExpected(bool enableHeadersVisualStylesParam, int rowIndexParam, ButtonState expectedButtonStateParam)
{
Expand Down Expand Up @@ -4049,7 +4049,7 @@ public void DataGridViewHeaderCell_MouseUpUnsharesRow_Invoke_ReturnsFalse(DataGr
Assert.Equal(ButtonState.Normal, cell.ButtonState);
}

[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public void DataGridViewHeaderCell_MouseUpUnsharesRow_InvokeWithDataGridView_ReturnsExpected()
{
// Run this from another thread as we call Application.EnableVisualStyles.
Expand Down Expand Up @@ -4156,7 +4156,7 @@ public static IEnumerable<object[]> OnMouseDown_WithDataGridView_TestData()
yield return new object[] { false, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0)), ButtonState.Normal };
}

[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public void DataGridViewHeaderCell_OnMouseDown_InvokeWithDataGridView_Nop()
{
// Run this from another thread as we call Application.EnableVisualStyles.
Expand Down Expand Up @@ -4188,7 +4188,7 @@ public void DataGridViewHeaderCell_OnMouseDown_InvokeWithDataGridView_Nop()
}).Dispose();
}

[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public void DataGridViewHeaderCell_OnMouseDown_InvalidRowIndexVisualStyles_ThrowsArgumentOutOfRangeException()
{
// Run this from another thread as we call Application.EnableVisualStyles.
Expand Down Expand Up @@ -4364,7 +4364,7 @@ public void DataGridViewHeaderCell_OnMouseLeave_VisualStyles_on_ThrowsArgumentOu
Assert.Throws<ArgumentOutOfRangeException>(() => cell.OnMouseLeave(rowIndex));
}

[WinFormsTheory(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsTheory]
[InlineData(true, -1)]
[InlineData(true, 0)]
[InlineData(false, -2)]
Expand Down Expand Up @@ -4399,7 +4399,7 @@ public void DataGridViewHeaderCell_OnMouseLeave_InvokeWithDataGridViewMouseDown_
}, enableHeadersVisualStylesParam.ToString(), rowIndexParam.ToString()).Dispose();
}

[WinFormsTheory(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsTheory]
[InlineData(-2)]
[InlineData(1)]
public void DataGridViewHeaderCell_OnMouseLeave_InvalidRowIndexVisualStyles_ThrowsArgumentOutOfRangeException(int rowIndexParam)
Expand Down Expand Up @@ -4538,7 +4538,7 @@ public static IEnumerable<object[]> OnMouseUp_WithDataGridViewMouseDown_TestData
yield return new object[] { false, new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 0, 0, 0)), ButtonState.Normal };
}

[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public void DataGridViewHeaderCell_OnMouseUp_InvokeWithDataGridViewMouseDown_ReturnsExpected()
{
// Run this from another thread as we call Application.EnableVisualStyles.
Expand Down Expand Up @@ -4571,7 +4571,7 @@ public void DataGridViewHeaderCell_OnMouseUp_InvokeWithDataGridViewMouseDown_Ret
}).Dispose();
}

[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public void DataGridViewHeaderCell_OnMouseUp_InvalidRowIndexVisualStyles_ThrowsArgumentOutOfRangeException()
{
// Run this from another thread as we call Application.EnableVisualStyles.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void ListViewInsertionMark_AppearsAfterItem_SetWithHandle_GetReturnsExpec
Assert.Equal(0, createdCallCount);
}

[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public unsafe void ListViewInsertionMark_AppearsAfterItem_GetInsertMark_Success()
{
// Run this from another thread as we call Application.EnableVisualStyles.
Expand Down Expand Up @@ -128,7 +128,7 @@ public unsafe void ListViewInsertionMark_AppearsAfterItem_GetInsertMark_Success(
}).Dispose();
}

[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public unsafe void ListViewInsertionMark_AppearsAfterItem_GetInsertMarkWithColor_Success()
{
// Run this from another thread as we call Application.EnableVisualStyles.
Expand Down Expand Up @@ -354,7 +354,7 @@ public void ListViewInsertionMark_Color_SetWithHandle_ReturnsExpected(Color valu
Assert.Equal(0, createdCallCount);
}

[WinFormsFact(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsFact]
public unsafe void ListViewInsertionMark_Color_GetInsertMarkColor_Success()
{
// Run this from another thread as we call Application.EnableVisualStyles.
Expand Down Expand Up @@ -448,7 +448,7 @@ public void ListViewInsertionMark_Index_SetWithHandle_GetReturnsExpected(int val
Assert.Equal(value, insertionMark.Index);
}

[WinFormsTheory(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsTheory]
[InlineData(-2)]
[InlineData(1)]
public unsafe void ListViewInsertionMark_Index_GetInsertMark_Success(int indexParam)
Expand Down Expand Up @@ -502,7 +502,7 @@ public unsafe void ListViewInsertionMark_Index_GetInsertMark_Success(int indexPa
}, indexParam.ToString()).Dispose();
}

[WinFormsTheory(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsTheory]
[InlineData(-2)]
[InlineData(1)]
public unsafe void ListViewInsertionMark_Index_GetInsertMarkWithColor_Success(int indexParam)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ public static void TabPage_BackColor_Get_ReturnsExpected(bool useVisualStyleBack
Assert.Equal(Control.DefaultBackColor, control.BackColor);
}

[WinFormsTheory(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsTheory]
[BoolData]
public static void TabPage_BackColor_GetVisualStyles_ReturnsExpected(bool useVisualStyleBackColorParam)
{
Expand Down Expand Up @@ -614,7 +614,7 @@ public static IEnumerable<object[]> BackColor_GetVisualStylesWithParent_TestData
yield return new object[] { false, TabAppearance.Normal, Control.DefaultBackColor };
}

[WinFormsTheory(Skip = "Crash with AbandonedMutexException. See: https://github.com/dotnet/arcade/issues/5325")]
[WinFormsTheory]
[MemberData(nameof(BackColor_GetVisualStylesWithParent_TestData))]
public static void TabPage_BackColor_GetVisualStylesWithParent_ReturnsExpected(bool useVisualStyleBackColorParam, TabAppearance parentAppearanceParam, Color expectedParam)
{
Expand Down

0 comments on commit 4b05a67

Please sign in to comment.