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

Fix #12661 Null Reference Exception: System.Windows.Forms.TabControl.<WmSelChange> #12683

Conversation

John-Qiao
Copy link
Member

@John-Qiao John-Qiao commented Dec 25, 2024

Fixes #12661

Proposed changes

  • Update the WmSelChange method in TabControl.cs to check if the AccessibilityObject is null before calling the method
  • Add a unit test to verify the fix

Customer Impact

  • Throw exception in Application.Run()

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

Throw exception in Application.Run()
Actual

After

No exception in runtime

Test methodology

  • Manually
  • Unit test

Test environment(s)

  • 10.0.0-alpha.1.24622.1
Microsoft Reviewers: Open in CodeFlow

@John-Qiao John-Qiao requested a review from a team as a code owner December 25, 2024 10:44
@John-Qiao John-Qiao changed the title Fix issue 12661 and add unit test Fix #12661 Null Reference Exception: System.Windows.Forms.TabControl.<WmSelChange> Dec 25, 2024
Copy link

codecov bot commented Dec 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.02571%. Comparing base (084e6d0) to head (098eabe).
Report is 26 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                  @@
##                main      #12683          +/-   ##
====================================================
+ Coverage   76.03186%   97.02571%   +20.99385%     
====================================================
  Files           3181        1191        -1990     
  Lines         639670      355480      -284190     
  Branches       47215        5446       -41769     
====================================================
- Hits          486353      344907      -141446     
+ Misses        149797        9770      -140027     
+ Partials        3520         803        -2717     
Flag Coverage Δ
Debug 97.02571% <100.00000%> (+20.99385%) ⬆️
integration ?
production ?
test 97.02571% <100.00000%> (-0.00344%) ⬇️
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

@Tanya-Solyanik Tanya-Solyanik added the 📭 waiting-author-feedback The team requires more information from the author label Jan 6, 2025
@dotnet-policy-service dotnet-policy-service bot removed the 📭 waiting-author-feedback The team requires more information from the author label Jan 7, 2025
Copy link
Member

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

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

Looks good! I added a comment about a test

@Tanya-Solyanik Tanya-Solyanik added the 📭 waiting-author-feedback The team requires more information from the author label Jan 7, 2025
@dotnet-policy-service dotnet-policy-service bot removed the 📭 waiting-author-feedback The team requires more information from the author label Jan 7, 2025
@Tanya-Solyanik Tanya-Solyanik added the 📭 waiting-author-feedback The team requires more information from the author label Jan 7, 2025
@dotnet-policy-service dotnet-policy-service bot removed the 📭 waiting-author-feedback The team requires more information from the author label Jan 8, 2025
Copy link
Member

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

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

Thank you!

Please work with Leaf to get this ported to the release/9 and release/8 branches.

@LeafShi1
Copy link
Member

LeafShi1 commented Jan 8, 2025

/backport to release/9.0

Copy link
Contributor

github-actions bot commented Jan 8, 2025

Started backporting to release/9.0: https://github.com/dotnet/winforms/actions/runs/12664765466

@LeafShi1 LeafShi1 merged commit 87bfb04 into dotnet:main Jan 8, 2025
8 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0 Preview1 milestone Jan 8, 2025
@LeafShi1
Copy link
Member

LeafShi1 commented Jan 8, 2025

/backport to release/8.0

Copy link
Contributor

github-actions bot commented Jan 8, 2025

Started backporting to release/8.0: https://github.com/dotnet/winforms/actions/runs/12664783112

Copy link
Contributor

github-actions bot commented Jan 8, 2025

@LeafShi1 backporting to release/8.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix issue 12661 and add unit test
Using index info to reconstruct a base tree...
A	src/System.Windows.Forms/src/System/Windows/Forms/Controls/TabControl/TabControl.cs
M	src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TabControlTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/TabControlTests.cs
Auto-merging src/System.Windows.Forms/src/System/Windows/Forms/TabControl.cs
CONFLICT (content): Merge conflict in src/System.Windows.Forms/src/System/Windows/Forms/TabControl.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Fix issue 12661 and add unit test
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

LeafShi1 pushed a commit to LeafShi1/winforms that referenced this pull request Jan 8, 2025
…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.
ricardobossan pushed a commit to ricardobossan/winforms that referenced this pull request Jan 9, 2025
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Null Reference Exception: System.Windows.Forms.TabControl.<WmSelChange>
3 participants