Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[release/9.0] InvalidOperationException when closing a dialog with focused DataGridView control #13348

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 5 commits into from
May 8, 2025

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Apr 23, 2025

Backport of #13320 to release/9.0
Fixes #13304

Proposed changes

  • When the DataGridView is in edit mode and the parent form is being closed, the DataGridView's EndEdit triggers the CurrentCell setting logic, because the DGV's handle has been destroyed at this time, we are re-creating it and then re-enter logic that sets up the current cell causing an exception to be thrown. Checking isHandleCreated before calling EndEdit can avoid executing related logic when the control has been destroyed, thereby preventing exceptions from occurring.

Customer Impact

  • When the DataGridView is in editing mode, its dialog box can be closed normally

Regression?

Testing

  • Manual testing with the user-provided project

Risk

  • Low
Microsoft Reviewers: Open in CodeFlow

@github-actions github-actions bot requested a review from a team as a code owner April 23, 2025 00:47
Copy link

codecov bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.83841%. Comparing base (61ec31a) to head (c97f912).
Report is 7 commits behind head on release/9.0.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           release/9.0      #13348         +/-   ##
=====================================================
+ Coverage     74.83837%   74.83841%   +0.00003%     
=====================================================
  Files             3022        3022                 
  Lines           630464      630465          +1     
  Branches         46801       46801                 
=====================================================
+ Hits            471829      471830          +1     
+ Misses          155246      155239          -7     
- Partials          3389        3396          +7     
Flag Coverage Δ
Debug 74.83841% <100.00000%> (+0.00003%) ⬆️
integration 18.00816% <100.00000%> (-0.00290%) ⬇️
production 47.87019% <100.00000%> (+0.00018%) ⬆️
test 97.00005% <ø> (ø)
unit 44.90738% <50.00000%> (+0.02551%) ⬆️

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@LeafShi1 LeafShi1 requested a review from Tanya-Solyanik April 23, 2025 02:30
LeafShi1 and others added 2 commits April 25, 2025 09:24
…sposed" (#13362)

* Removing tag OperationInReleasingDataSource 

* Add judgment IsHandleCreated to before defining currentCell in function SetCurrentCellAddressCore
@LeafShi1 LeafShi1 force-pushed the backport/pr-13320-to-release/9.0 branch from a21947d to c97f912 Compare April 25, 2025 01:26
@Tanya-Solyanik Tanya-Solyanik changed the title [release/9.0] Add _isReleasingDataSource to prevent unnecessary operations on CurrentCell when changing or releasing DataSource [release/9.0] InvalidOperationException when closing a dialog with focused DataGridView control Apr 25, 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 Apr 25, 2025
@Tanya-Solyanik Tanya-Solyanik added servicing-approved .NET Shiproom approved the PR for merge and removed servicing-consider .NET Shiproom label indicating a PR seeks to enter into a branch under Tell-Mode criteria labels Apr 29, 2025
@Tanya-Solyanik Tanya-Solyanik added this to the 9.0.6 milestone Apr 29, 2025
@LeafShi1 LeafShi1 merged commit 1390aa6 into release/9.0 May 8, 2025
8 checks passed
@LeafShi1 LeafShi1 deleted the backport/pr-13320-to-release/9.0 branch May 8, 2025 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚫 * NO-MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) servicing-approved .NET Shiproom approved the PR for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants