{"action":"created","issue":{"url":"https://api.github.com/repos/DynamoDS/Dynamo/issues/4930","labels_url":"https://api.github.com/repos/DynamoDS/Dynamo/issues/4930/labels{/name}","comments_url":"https://api.github.com/repos/DynamoDS/Dynamo/issues/4930/comments","events_url":"https://api.github.com/repos/DynamoDS/Dynamo/issues/4930/events","html_url":"https://github.com/DynamoDS/Dynamo/pull/4930","id":95130406,"number":4930,"title":"MAGN-7879: Dynamo crash because of InCanvasSearch","user":{"login":"aosyatnik","id":8158404,"avatar_url":"https://avatars.githubusercontent.com/u/8158404?v=3","gravatar_id":"","url":"https://api.github.com/users/aosyatnik","html_url":"https://github.com/aosyatnik","followers_url":"https://api.github.com/users/aosyatnik/followers","following_url":"https://api.github.com/users/aosyatnik/following{/other_user}","gists_url":"https://api.github.com/users/aosyatnik/gists{/gist_id}","starred_url":"https://api.github.com/users/aosyatnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aosyatnik/subscriptions","organizations_url":"https://api.github.com/users/aosyatnik/orgs","repos_url":"https://api.github.com/users/aosyatnik/repos","events_url":"https://api.github.com/users/aosyatnik/events{/privacy}","received_events_url":"https://api.github.com/users/aosyatnik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"ikeough","id":1139788,"avatar_url":"https://avatars.githubusercontent.com/u/1139788?v=3","gravatar_id":"","url":"https://api.github.com/users/ikeough","html_url":"https://github.com/ikeough","followers_url":"https://api.github.com/users/ikeough/followers","following_url":"https://api.github.com/users/ikeough/following{/other_user}","gists_url":"https://api.github.com/users/ikeough/gists{/gist_id}","starred_url":"https://api.github.com/users/ikeough/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikeough/subscriptions","organizations_url":"https://api.github.com/users/ikeough/orgs","repos_url":"https://api.github.com/users/ikeough/repos","events_url":"https://api.github.com/users/ikeough/events{/privacy}","received_events_url":"https://api.github.com/users/ikeough/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-07-15T08:03:21Z","updated_at":"2015-07-17T04:38:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/4930","html_url":"https://github.com/DynamoDS/Dynamo/pull/4930","diff_url":"https://github.com/DynamoDS/Dynamo/pull/4930.diff","patch_url":"https://github.com/DynamoDS/Dynamo/pull/4930.patch"},"body":"### Purpose\r\n\r\nLink to YouTrack:\r\n[MAGN-7879](http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-7879) Graph populated with in-canvas search gives crash after it is re-opened from Recent Files\r\n\r\nIt's really interesting bug. To reproduce it you need:\r\n1) Call `InCanvasSearch` by Shift+DoubleClick and type something. You even do not need to create any node. Just type and click somewhere out of InCanvasSearch.\r\n2) Open any `.dyn` file.\r\n3) Get exception.\r\n\r\nThe reason of exception lies in the `SearchHighlightMarginConverter`. This converter is used in `LibrarySearchView` and in `InCanvasSearchControl`. It used for margin this tiny grey rectangle.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/8158404/8693400/821005fe-2adf-11e5-9243-3107879c0836.png)\r\n\r\nFor every Workspace it's used its' own `InCanvasSearch`. So, when new workspace is created, incanvas-search is created as well.\r\n`SearchHighlightMarginConverter` needs `SearchViewModel`. This is ViewModel, that is used for InCanvasSearch. I don't know why it does work for context-menu InCanvasSearch and doesn't work for double-click InCanvasSearch...\r\nBUT `SearchHighlightMarginConverter` for double-click `InCanvasSearch` is called, when ViewModel is null. I.e. `DataContext` has NOT been initialized yet. Maybe context-menu and popup use different algorithm of calling converters.\r\n\r\nSo, what I meant to say. The easiest solution is just add additional null-check in `SearchHighlightMarginConverter`. And let it wait until `DataContext` is initialized.\r\n\r\n### Declarations\r\n\r\nCheck these if you believe they are true\r\n\r\n- [x] The code base is in a better state after this PR\r\n- [ ] The level of testing this PR includes is appropriate\r\n- [ ] User facing strings, if any, are extracted into `*.resx` files\r\n\r\n### Reviewers\r\n\r\n@pboyer \r\nor\r\n@Benglin \r\n\r\n### FYIs\r\n\r\n@kronz "},"comment":{"url":"https://api.github.com/repos/DynamoDS/Dynamo/issues/comments/122170813","html_url":"https://github.com/DynamoDS/Dynamo/pull/4930#issuecomment-122170813","issue_url":"https://api.github.com/repos/DynamoDS/Dynamo/issues/4930","id":122170813,"user":{"login":"ikeough","id":1139788,"avatar_url":"https://avatars.githubusercontent.com/u/1139788?v=3","gravatar_id":"","url":"https://api.github.com/users/ikeough","html_url":"https://github.com/ikeough","followers_url":"https://api.github.com/users/ikeough/followers","following_url":"https://api.github.com/users/ikeough/following{/other_user}","gists_url":"https://api.github.com/users/ikeough/gists{/gist_id}","starred_url":"https://api.github.com/users/ikeough/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikeough/subscriptions","organizations_url":"https://api.github.com/users/ikeough/orgs","repos_url":"https://api.github.com/users/ikeough/repos","events_url":"https://api.github.com/users/ikeough/events{/privacy}","received_events_url":"https://api.github.com/users/ikeough/received_events","type":"User","site_admin":false},"created_at":"2015-07-17T04:38:40Z","updated_at":"2015-07-17T04:38:40Z","body":"One small comment then LGTM."}}