-
Notifications
You must be signed in to change notification settings - Fork 752
Fix unhandled exception when double-clicking in scroll bar area with no selected nodes #2254
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
Conversation
… related methods Co-authored-by: brianrob <6210322+brianrob@users.noreply.github.com>
|
The current implementation is functionally correct, but has regressed performance when scrolling in the stack viewer. Scrolling without the change is very smooth, but is super-choppy with the change. I captured before and after traces, and found that there are a couple of differences worth calling out:
Regressed: Baseline: @copilot, please investigate further and see if you can make a fix that addresses the functional issue without regressing performance. |
…mouse double-click handling Co-authored-by: brianrob <6210322+brianrob@users.noreply.github.com>
Fixed the performance regression in commit b7b0395. The issue was that my original fix added GetSelectedNodes() calls to all Do* methods, creating unnecessary object allocations during normal command execution. The WPF command system already handles CanExecute validation with SingleNodeIsSelected, so those defensive checks were redundant. I reverted those changes and instead added a targeted check only in ByName_MouseDoubleClick before calling DoViewInCallers. This approach:
|
|
Copilot Post-Mortem:
|
| DoViewInCallers(sender, null); | ||
| } | ||
| } | ||
| internal void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: formatting, should be new line between methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed formatting by adding blank line between methods in commit 6d2c944.
mconnew
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
Co-authored-by: mconnew <8648390+mconnew@users.noreply.github.com>
mconnew
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
Problem
Double-clicking in the right scroll bar area of the StackWindow causes an unhandled exception crash with the error "Sequence contains no elements". This occurs when clicking rapidly on scroll arrows to navigate upwards and reaching the end, or when double-clicking on the scroll bar when no nodes are selected.
The issue stems from the
ByName_MouseDoubleClickevent handler directly callingDoViewInCallers, which then callsGetSelectedNodes().Single()without checking if any nodes are actually selected.Root Cause
The stack trace shows:
When a user double-clicks on the scroll bar area, the mouse event bypasses the command system's
CanExecutechecks that would normally prevent execution when no nodes are selected. TheByName_MouseDoubleClickmethod directly callsDoViewInCallers(sender, null), which then attempts to call.Single()on an empty collection returned byGetSelectedNodes().Solution
Added defensive check in
ByName_MouseDoubleClick.Fixes #2253.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.