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

Issue 12353 fix detach context menu strip memory leak #12399

Conversation

LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Oct 29, 2024

Related #12353

Proposed changes

  • Removing reference to ContextMenuStrip when disposing control

Customer Impact

  • No memory leak when ContextMenuStrip property is set on a control

Regression?

  • No

Screenshots

Before

When the ContextMenuStrip property is set on a control, a memory leak will occur
BeforeChangesOfIssue12353

After

No memory leak when ContextMenuStrip property is set on a control
AfterChangesForIssue12353

Test methodology

  • Manually

Test environment(s)

  • .net 10.0.0-alpha.1.24527.3
Microsoft Reviewers: Open in CodeFlow

@LeafShi1
Copy link
Member Author

There are 2 issues in issue #12353, this PR can only resolve the issue1

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.17370%. Comparing base (afa9b7c) to head (8fa5b5f).
Report is 10 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (afa9b7c) and HEAD (8fa5b5f). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (afa9b7c) HEAD (8fa5b5f)
Debug 3 2
test 1 0
Additional details and impacted files
@@                 Coverage Diff                  @@
##                main      #12399          +/-   ##
====================================================
- Coverage   75.63691%   49.17370%   -26.46322%     
====================================================
  Files           3147        1991        -1156     
  Lines         635806      284160      -351646     
  Branches       47012       41731        -5281     
====================================================
- Hits          480904      139732      -341172     
+ Misses        151456      141732        -9724     
+ Partials        3446        2696         -750     
Flag Coverage Δ
Debug 49.17370% <100.00000%> (-26.46322%) ⬇️
integration 18.24269% <100.00000%> (+0.00220%) ⬆️
production 49.17370% <100.00000%> (+0.01231%) ⬆️
test ?
unit 46.15463% <100.00000%> (+0.01941%) ⬆️

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

@dotnet-policy-service dotnet-policy-service bot added the draft draft PR label Oct 29, 2024
@LeafShi1 LeafShi1 removed the draft draft PR label Oct 31, 2024
@LeafShi1 LeafShi1 force-pushed the Issue_12353_fix_DetachContextMenuStrip_MemoryLeak branch 3 times, most recently from c8e0d8e to 929659e Compare October 31, 2024 07:39
@LeafShi1 LeafShi1 marked this pull request as ready for review October 31, 2024 07:40
@LeafShi1 LeafShi1 requested a review from a team as a code owner October 31, 2024 07:40
@LeafShi1 LeafShi1 force-pushed the Issue_12353_fix_DetachContextMenuStrip_MemoryLeak branch from 929659e to a6a4ac9 Compare October 31, 2024 07:51
@Tanya-Solyanik Tanya-Solyanik added the 📭 waiting-author-feedback The team requires more information from the author label Oct 31, 2024
@dotnet-policy-service dotnet-policy-service bot removed the 📭 waiting-author-feedback The team requires more information from the author label Nov 1, 2024
@Tanya-Solyanik Tanya-Solyanik added the ready-to-merge PRs that are ready to merge but worth notifying the internal team. label Nov 1, 2024
@LeafShi1 LeafShi1 merged commit 71d5680 into dotnet:main Nov 4, 2024
8 checks passed
@LeafShi1 LeafShi1 deleted the Issue_12353_fix_DetachContextMenuStrip_MemoryLeak branch November 4, 2024 02:27
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0 Preview1 milestone Nov 4, 2024
@dotnet-policy-service dotnet-policy-service bot removed the ready-to-merge PRs that are ready to merge but worth notifying the internal team. label Nov 4, 2024
paul1956 pushed a commit to paul1956/winforms that referenced this pull request Nov 5, 2024
* Removing reference to ContextMenuStrip when dispose control

* Merge 'main' to current branch

* Detach ContextMenuStrip from control when executing Dispose

* Use pattern matching for judge variable menu
@chaowendy
Copy link

chaowendy commented Nov 7, 2024

Verified this issue in the latest .NET 10.0 SDK build: 10.0.100 - alpha.1.24556.12, it was fixed as following:
image

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.

4 participants