dotnet / dotnet/winforms

Re-enable skipped test: `Control_SelectNextControl_ToolStrips_CycleForwardExpected`

Open
#6,730 0 comments 0 reactions 0 assignees View on GitHub
test-bug
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

* .NET Core Version: 7.0

* Have you experienced this same bug with .NET Framework?: No

**Problem description:**
- Test fails sometimes in CI build for successful PRs, that blocking deployment of fixes into sdk:
Control_SelectNextControl_ToolStrips_CycleForwardExpected:
Stack trace ([CI build 1620740](https://dev.azure.com/dnceng/public/_build/results?buildId=1620740&view=ms.vss-test-web.build-test-results-tab&runId=45061952&resultId=114518&paneView=debug)):
```
at System.Windows.Forms.Control.ControlCollection.GetChildIndex(Control child, Boolean throwException) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Control.ControlCollection.cs:line 466
at System.Windows.Forms.Control.ControlCollection.GetChildIndex(Control child) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Control.ControlCollection.cs:line 452
at System.Windows.Forms.Control.ControlCollection.SetChildIndexInternal(Control child, Int32 newIndex) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Control.ControlCollection.cs:line 481
at System.Windows.Forms.Control.ControlCollection.SetChildIndex(Control child, Int32 newIndex) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Control.ControlCollection.cs:line 507
at System.Windows.Forms.Control.SendToBack() in /_/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs:line 10703
at System.Windows.Forms.Control.ControlCollection.Add(Control value) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Control.ControlCollection.cs:line 68
at System.Windows.Forms.ReadOnlyControlCollection.AddInternal(Control value) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ReadOnlyControlCollection.cs:line 33
at System.Windows.Forms.ToolStripControlHost.SyncControlParent() in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripControlHost.cs:line 817
at System.Windows.Forms.ToolStripControlHost.OnParentChanged(ToolStrip oldParent, ToolStrip newParent) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripControlHost.cs:line 705
at System.Windows.Forms.ToolStripItem.set_ParentInternal(ToolStrip value) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripItem.cs:line 1542
at System.Windows.Forms.ToolStripSplitStackLayout.LayoutHorizontal() in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripSplitStackLayout.cs:line 367
at System.Windows.Forms.ToolStripSplitStackLayout.LayoutCore(IArrangedElement container, LayoutEventArgs layoutEventArgs) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripSplitStackLayout.cs:line 237
at System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Layout/LayoutEngine.cs:line 44
at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs:line 8273
at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ScrollableControl.cs:line 628
at System.Windows.Forms.ToolStrip.OnLayout(LayoutEventArgs e) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStrip.cs:line 3575
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs:line 8990
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs:line 13429
at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Layout/LayoutTransaction.cs:line 98
at System.Windows.Forms.ToolStrip.DoLayoutIfHandleCreated(ToolStripItemEventArgs e) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStrip.cs:line 2164
at System.Windows.Forms.ToolStrip.OnItemVisibleChanged(ToolStripItemEventArgs e, Boolean performLayout) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStrip.cs:line 3554
at System.Windows.Forms.ToolStrip.OnItemRemoved(ToolStripItemEventArgs e) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStrip.cs:line 3529
at System.Windows.Forms.ToolStripItemCollection.OnAfterRemove(ToolStripItem item) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripItemCollection.cs:line 405
at System.Windows.Forms.ToolStripItemCollection.Remove(ToolStripItem value) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripItemCollection.cs:line 427
at System.Windows.Forms.ToolStripItem.Dispose(Boolean disposing) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripItem.cs:line 2099
at System.Windows.Forms.ToolStripDropDownItem.Dispose(Boolean disposing) in /_/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripDropDownItem.cs:line 373
at System.ComponentModel.Component.Dispose()
at System.Windows.Forms.Tests.ControlTests.Control_SelectNextControl_ToolStrips_CycleForwardExpected(RightToLeft rightToLeft) in /_/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ControlTests.cs:line 918
```
Error message:
```
System.ArgumentException : 'child' is not a child control of this parent.
```

**PS.**: The first investigation shows, that looks like the reason is an incorrect call of `SyncControlParent` in `ToolStripControlHost` (line 705).

**Expected behavior:**
- All correct tests pass every time.

**Minimal repro:**
- Run CI build, it reproduces sometimes

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.