Skip to content

Dispose Cursor in tests #8793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2023
Merged

Dispose Cursor in tests #8793

merged 1 commit into from
Mar 20, 2023

Conversation

gpetrou
Copy link
Contributor

@gpetrou gpetrou commented Mar 12, 2023

Proposed changes

  • Dispose Cursor in tests.
Microsoft Reviewers: Open in CodeFlow

@gpetrou gpetrou requested a review from a team as a code owner March 12, 2023 08:14
@ghost ghost assigned gpetrou Mar 12, 2023
@@ -33,7 +33,7 @@ public class CursorTestsFixture : IDisposable
public void Cursor_Ctor_IntPtr()
{
Cursor sourceCursor = Cursors.AppStarting;
var cursor = new Cursor(sourceCursor.Handle);
using var cursor = new Cursor(sourceCursor.Handle);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really needed because cursor does not own the handle, but this looks consistent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And some of the cases below. Either remove using or wait until #8772 merges.
we are going to make changes ( in #8772 ) to properly dispose the cursor that process owns.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be safe with #8865

@Tanya-Solyanik
Copy link
Contributor

System.Windows.Forms.UITests.ButtonTests.Button_DialogResult_ClickDefaultButtonToCloseFormAsync(dialogResult: Retry)
Assert.Equal() Failure\r\nExpected: Retry\r\nActual: None

at System.Windows.Forms.UITests.ButtonTests.<>c__DisplayClass1_0.<<Button_DialogResult_ClickDefaultButtonToCloseFormAsync>b__0>d.MoveNext() in //src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/ButtonTests.cs:line 49
--- End of stack trace from previous location ---
at System.Windows.Forms.UITests.ControlTestBase.<>c__DisplayClass28_01.<<RunFormAsync>b__0>d.MoveNext() in /_/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/Infra/ControlTestBase.cs:line 240 --- End of stack trace from previous location --- at Microsoft.VisualStudio.Threading.JoinableTask.JoinAsync(CancellationToken cancellationToken) at System.Windows.Forms.UITests.ControlTestBase.RunFormAsync[T](Func1 createDialog, Func3 testDriverAsync) in /_/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/Infra/ControlTestBase.cs:line 259 at System.Windows.Forms.UITests.ControlTestBase.RunSingleControlTestAsync[T](Func3 testDriverAsync, Func1 createControl, Func1 createForm) in /
/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/Infra/ControlTestBase.cs:line 177
at System.Windows.Forms.UITests.ButtonTests.RunTestAsync(Func`3 runTest) in //src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/ButtonTests.cs:line 390
at System.Windows.Forms.UITests.ButtonTests.Button_DialogResult_ClickDefaultButtonToCloseFormAsync(DialogResult dialogResult) in /
/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/ButtonTests.cs:line 32
--- End of stack trace from previous location ---

@Tanya-Solyanik
Copy link
Contributor

System.Windows.Forms.UITests.ButtonTests.Button_Mouse_Press_With_Drag_Off_Button_And_Back_Does_Cause_Button_ClickAsync

Assert.Equal() Failure\r\nExpected: 1\r\nActual: 0

at System.Windows.Forms.UITests.ButtonTests.<Button_Mouse_Press_With_Drag_Off_Button_And_Back_Does_Cause_Button_ClickAsync>b__11_0(Form form, ValueTuple2 controls) in /_/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/ButtonTests.cs:line 308 at System.Windows.Forms.UITests.ControlTestBase.<>c__DisplayClass28_01.<b__0>d.MoveNext() in //src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/Infra/ControlTestBase.cs:line 240
--- End of stack trace from previous location ---
at Microsoft.VisualStudio.Threading.JoinableTask.JoinAsync(CancellationToken cancellationToken)
at System.Windows.Forms.UITests.ControlTestBase.RunFormAsync[T](Func1 createDialog, Func3 testDriverAsync) in /
/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/Infra/ControlTestBase.cs:line 259
at System.Windows.Forms.UITests.ControlTestBase.RunControlPairTestAsync[T1,T2](Func`3 testDriverAsync) in //src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/Infra/ControlTestBase.cs:line 206
at System.Windows.Forms.UITests.ButtonTests.Button_Mouse_Press_With_Drag_Off_Button_And_Back_Does_Cause_Button_ClickAsync() in /
/src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/ButtonTests.cs:line 280
--- End of stack trace from previous location ---

@dreddy-work dreddy-work added the waiting-author-feedback The team requires more information from the author label Mar 13, 2023
@dreddy-work dreddy-work enabled auto-merge (squash) March 16, 2023 23:41
@dreddy-work dreddy-work disabled auto-merge March 16, 2023 23:41
@dreddy-work dreddy-work enabled auto-merge (squash) March 16, 2023 23:41
@dreddy-work dreddy-work added ready-to-merge PRs that are ready to merge but worth notifying the internal team. and removed waiting-author-feedback The team requires more information from the author labels Mar 20, 2023
@dreddy-work
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@dreddy-work dreddy-work merged commit acc7e48 into dotnet:main Mar 20, 2023
@ghost ghost added this to the 8.0 Preview3 milestone Mar 20, 2023
@ghost ghost removed the ready-to-merge PRs that are ready to merge but worth notifying the internal team. label Mar 20, 2023
@gpetrou gpetrou deleted the Cursor branch March 21, 2023 17:52
@ghost ghost locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants