Skip to content
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

[release/8.0] Fix #12661 Null Reference Exception: System.Windows.Forms.TabControl<WmSelChange> #12731

Merged

Conversation

LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Jan 8, 2025

Backport of #12683 to release/8.0
Fixes #12661

Customer Impact

A customer reported a crash in their application that uses WinForms TabControl and requested a fix in NET8 release. Application is running under accessibility tools and is removing TabPages from a control dynamically. When the selected page is removed, the selection moves to the next page and the corresponding accessibility event is queued using BeginInvoke to be raised. If by the time the event is raised, the page is removed, a NullReferenceException is thrown. No workaround is available.

Fix

Test if the selected page is still available before raising the accessibility event inside the BeginInvoke delegate.

Testing

Manual with the customer repro case and unit tests.

Risk

Low - this is an additional validation only.

Microsoft Reviewers: Open in CodeFlow

…ntrol.<WmSelChange> (dotnet#12683)

* Fix issue 12661 and add unit test

* Updated the unit test code lines to resolve the conversations from Tanya

* Updated the BeginInvoke delegate in WmSelChange()

* Removed that TabControl_WmSelChange_AccessibilityObjectNotCreated_NoAutomationEventRaised() test

* Removed the unnecessary code lines from TabControlTests.cs file.
@LeafShi1 LeafShi1 requested a review from a team as a code owner January 8, 2025 08:12
@LeafShi1 LeafShi1 changed the title Fix #12661 Null Reference Exception: System.Windows.Forms.TabControl<WmSelChange> [release/8.0] Fix #12661 Null Reference Exception: System.Windows.Forms.TabControl<WmSelChange> Jan 8, 2025
@Tanya-Solyanik Tanya-Solyanik added 🚫 * NO-MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) servicing-consider .NET Shiproom label indicating a PR seeks to enter into a branch under Tell-Mode criteria labels Jan 8, 2025
@Tanya-Solyanik Tanya-Solyanik added servicing-approved .NET Shiproom approved the PR for merge and removed 🚫 * NO-MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) servicing-consider .NET Shiproom label indicating a PR seeks to enter into a branch under Tell-Mode criteria labels Jan 8, 2025
@Tanya-Solyanik Tanya-Solyanik merged commit 5d67166 into dotnet:release/8.0 Jan 8, 2025
8 checks passed
@LeafShi1 LeafShi1 deleted the backport/pr-12683-to-release/8.0 branch January 9, 2025 01:05
@Tanya-Solyanik Tanya-Solyanik added this to the 8.0.13 milestone Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
servicing-approved .NET Shiproom approved the PR for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants