{"action":"opened","issue":{"url":"https://api.github.com/repos/xamarin/Xamarin.Forms/issues/3602","repository_url":"https://api.github.com/repos/xamarin/Xamarin.Forms","labels_url":"https://api.github.com/repos/xamarin/Xamarin.Forms/issues/3602/labels{/name}","comments_url":"https://api.github.com/repos/xamarin/Xamarin.Forms/issues/3602/comments","events_url":"https://api.github.com/repos/xamarin/Xamarin.Forms/issues/3602/events","html_url":"https://github.com/xamarin/Xamarin.Forms/issues/3602","id":351679346,"node_id":"MDU6SXNzdWUzNTE2NzkzNDY=","number":3602,"title":"Retain Strategy on Listview with DataTemplateSelector causes BindingContext to revert to null","user":{"login":"PureWeen","id":5375137,"node_id":"MDQ6VXNlcjUzNzUxMzc=","avatar_url":"https://avatars1.githubusercontent.com/u/5375137?v=4","gravatar_id":"","url":"https://api.github.com/users/PureWeen","html_url":"https://github.com/PureWeen","followers_url":"https://api.github.com/users/PureWeen/followers","following_url":"https://api.github.com/users/PureWeen/following{/other_user}","gists_url":"https://api.github.com/users/PureWeen/gists{/gist_id}","starred_url":"https://api.github.com/users/PureWeen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PureWeen/subscriptions","organizations_url":"https://api.github.com/users/PureWeen/orgs","repos_url":"https://api.github.com/users/PureWeen/repos","events_url":"https://api.github.com/users/PureWeen/events{/privacy}","received_events_url":"https://api.github.com/users/PureWeen/received_events","type":"User","site_admin":false},"labels":[{"id":978571036,"node_id":"MDU6TGFiZWw5Nzg1NzEwMzY=","url":"https://api.github.com/repos/xamarin/Xamarin.Forms/labels/e/4%20:clock4:","name":"e/4 :clock4:","color":"23d3cd","default":false},{"id":343860851,"node_id":"MDU6TGFiZWwzNDM4NjA4NTE=","url":"https://api.github.com/repos/xamarin/Xamarin.Forms/labels/t/bug%20:bug:","name":"t/bug :bug:","color":"fc2929","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-17T17:39:00Z","updated_at":"2018-08-17T17:39:00Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### Description\r\nThe issue seems to come up because of this await\r\n\r\nhttps://github.com/xamarin/Xamarin.Forms/blob/a9a7277ad8d6b40a9f28081c248ba282a6476d95/Xamarin.Forms.Core/TemplatedItemsList.cs#L1206\r\n\r\nThe await happens, a new template is swapped in, and then the above code sets the BindingContext back to null. If you set the ListView Cache strategy to Recycle the issue doesn't happen because that await doesn't occur\r\n\r\nFor example I had to do this little hack here\r\n\r\nhttps://github.com/xamarin/Xamarin.Forms/pull/3518/files#diff-bb6d28847711cc5f78841d28a70d000bR168\r\n\r\nTo make sure the BindingContext doesn't get reset back to null after already being set inside the DataTemplateSelector\r\n\r\n\r\n### Reproduction\r\nIn the Control Gallery remove the hack I added above and you'll see the effect of the BindingContext getting set and then unset to null because of the race condition\r\n\r\n### Steps to Reproduce\r\n\r\n1. \r\n2. \r\n3. \r\n\r\n### Expected Behavior\r\n\r\n### Actual Behavior\r\n\r\n### Basic Information\r\n\r\n- Version with issue:\r\n- Last known good version:\r\n- IDE:\r\n- Platform Target Frameworks: <!-- All that apply -->\r\n  - iOS:  <!-- The version of the iOS SDK you are compiling against, e.g. 11.1 -->\r\n  - Android: <!-- The version of the Android SDK you are compiling against, e.g. 7.1 --> \r\n  - UWP:  <!-- The version of the UWP SDK you are compiling against, e.g. 16299 --> \r\n- Android Support Library Version: <!-- if applicable -->\r\n- Nuget Packages:\r\n- Affected Devices:\r\n\r\n### Screenshots\r\n\r\n<!-- If the issue is a visual issue, please include screenshots showing the problem if possible -->\r\n\r\n### Reproduction Link\r\n\r\n<!-- Please upload or provide a link to a reproduction case -->\r\n"}}
{"actor":{"display_login":"PureWeen"}}