-
Notifications
You must be signed in to change notification settings - Fork 635
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 watchTree silent crash #12975
fix watchTree silent crash #12975
Conversation
A wpf control can trigger Loaded event multiple times (some without DataContext) Here is the callstack caught with GFlags
|
I still did not figure out why the exception is not caught by sandbox... |
@@ -22,9 +22,13 @@ public partial class WatchTree : UserControl | |||
private readonly int minWidthSize = 100; | |||
private readonly int minHeightSize = 38; | |||
|
|||
public WatchTree() | |||
public WatchTree(WatchViewModel vm) |
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.
this should be ok to break right ?
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.
yes
@pinzart90 what is the actual exception? Is something null? |
The _vm (WatchViewModel) is null You might be right about the crash handler... |
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.
Just curious, what is the tool you used to debug this (screenshot in the PR description)? Can the exception be found while debugging in VS?
@@ -39,15 +39,15 @@ public void CustomizeView(Watch nodeModel, NodeView nodeView) | |||
this.watch = nodeModel; | |||
this.syncContext = new DispatcherSynchronizationContext(nodeView.Dispatcher); | |||
|
|||
var watchTree = new WatchTree(); |
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.
Is any of this code new to 2.15 that causes this to fail only in 2.15?
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.
Hard to tell by looking at the code...multiple things can contribute to this bug
The critical area (IMO) is the Loaded
event ...that assumes a DataContext exists. That part of the code has been there for a while.
The loaded event can be triggered multiple times with/without data context. Looks like at least in 2.15...a Loaded event is triggered without data context (when opening the .dyn attached to the jira task)
This seems to be acceptable (from what I have read) but we should not always assume the context exists.
The exception does not trigger when the debugger is attached. |
LGTM! |
I removed the new unit test because it did not reproduce the issue (without the code fix). |
let's not merge this until we remove the 3 megabyte file which no longer reproduces the bug - I will remove it. |
I also can't reproduce this with either test file, in my tests it seems watchTree_loaded is now only called once, but the changes make sense to me and seem easier to reason about than what was happening previously. I'm going to merge this and monitor for any regressions. |
https://jira.autodesk.com/browse/DYN-5005
Purpose
Fix silent crash when opening up graph
Declarations
Check these if you believe they are true
*.resx
filesRelease Notes
(FILL ME IN) Brief description of the fix / enhancement. Mandatory section
Reviewers
(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)
(FILL ME IN, optional) Any additional notes to reviewers or testers.
FYIs
(FILL ME IN, Optional) Names of anyone else you wish to be notified of