{"action":"closed","issue":{"url":"https://api.github.com/repos/amay077/Xamarin.Forms.GoogleMaps/issues/12","repository_url":"https://api.github.com/repos/amay077/Xamarin.Forms.GoogleMaps","labels_url":"https://api.github.com/repos/amay077/Xamarin.Forms.GoogleMaps/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/amay077/Xamarin.Forms.GoogleMaps/issues/12/comments","events_url":"https://api.github.com/repos/amay077/Xamarin.Forms.GoogleMaps/issues/12/events","html_url":"https://github.com/amay077/Xamarin.Forms.GoogleMaps/issues/12","id":162327339,"number":12,"title":"Android: Selecting pin from logic causes error","user":{"login":"kochizufan","id":2221431,"avatar_url":"https://avatars.githubusercontent.com/u/2221431?v=3","gravatar_id":"","url":"https://api.github.com/users/kochizufan","html_url":"https://github.com/kochizufan","followers_url":"https://api.github.com/users/kochizufan/followers","following_url":"https://api.github.com/users/kochizufan/following{/other_user}","gists_url":"https://api.github.com/users/kochizufan/gists{/gist_id}","starred_url":"https://api.github.com/users/kochizufan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kochizufan/subscriptions","organizations_url":"https://api.github.com/users/kochizufan/orgs","repos_url":"https://api.github.com/users/kochizufan/repos","events_url":"https://api.github.com/users/kochizufan/events{/privacy}","received_events_url":"https://api.github.com/users/kochizufan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/amay077/Xamarin.Forms.GoogleMaps/labels/bug","name":"bug","color":"ee0701"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-26T13:15:36Z","updated_at":"2016-06-26T14:36:16Z","closed_at":"2016-06-26T14:36:16Z","body":"In Android sample project, adding New York pin and pushing \"Select New York\" button causes errors.\r\n\r\nError is at Android's MapRenderer#UpdateSelectedPin\r\n\r\n```\r\n        void UpdateSelectedPin(Pin pin)\r\n        {\r\n            if (pin == null)\r\n            {\r\n                foreach (var marker in _markers)\r\n                {\r\n                    marker.HideInfoWindow();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                // lookup pin\r\n                Marker targetMarker = null;\r\n                foreach (var marker in _markers)\r\n                {\r\n                    if ((string)pin.Id != marker.Id) <= Here\r\n                        continue;\r\n\r\n                    targetMarker = marker;\r\n                    break;\r\n                }\r\n\r\n                if (targetMarker != null)\r\n                    targetMarker.ShowInfoWindow();\r\n            }\r\n        }\r\n```\r\nand said \"Specified cast is not valid\".\r\n\r\nFull error message is:\r\n\r\n> System.InvalidCastException: Specified cast is not valid.\r\n>   at Xamarin.Forms.GoogleMaps.Android.MapRenderer.UpdateSelectedPin (Xamarin.Forms.GoogleMaps.Pin pin) [0x00075] in /Users/xxxx/github/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.Android/MapRenderer.cs:408\r\n>   at Xamarin.Forms.GoogleMaps.Android.MapRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00127] in /Users/xxxx/github/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.Android/MapRenderer.cs:313\r\n>   at at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)\r\n>   at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in C:\\BuildAgent2\\work\\aad494dc9bc9783\\Xamarin.Forms.Core\\BindableObject.cs:137\r\n>   at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in C:\\BuildAgent2\\work\\aad494dc9bc9783\\Xamarin.Forms.Core\\Element.cs:370\r\n>   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindablePropertyContext context, System.Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent) [0x000f4] in C:\\BuildAgent2\\work\\aad494dc9bc9783\\Xamarin.Forms.Core\\BindableObject.cs:581\r\n>   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes) [0x0014b] in C:\\BuildAgent2\\work\\aad494dc9bc9783\\Xamarin.Forms.Core\\BindableObject.cs:378\r\n>   at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, Boolean fromStyle, Boolean checkAccess) [0x0005f] in C:\\BuildAgent2\\work\\aad494dc9bc9783\\Xamarin.Forms.Core\\BindableObject.cs:531\r\n>   at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in C:\\BuildAgent2\\work\\aad494dc9bc9783\\Xamarin.Forms.Core\\BindableObject.cs:83\r\n>   at Xamarin.Forms.GoogleMaps.Map.set_SelectedPin (Xamarin.Forms.GoogleMaps.Pin value) [0x00008] in /Users/xxxx/github/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps/Map.cs:74\r\n>   at XFGoogleMapSample.PinsPage+<PinsPage>c__AnonStorey0.<>m__5 (System.Object sender, System.EventArgs e) [0x00044] in /Users/xxxx/github/Xamarin.Forms.GoogleMaps/XFGoogleMapSample/XFGoogleMapSample/PinsPage.xaml.cs:99\r\n>   at Xamarin.Forms.Button.Xamarin.Forms.IButtonController.SendClicked () [0x00020] in C:\\BuildAgent2\\work\\aad494dc9bc9783\\Xamarin.Forms.Core\\Button.cs:122\r\n>   at Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer+ButtonClickListener.OnClick (Android.Views.View v) [0x0000b] in C:\\BuildAgent2\\work\\aad494dc9bc9783\\Xamarin.Forms.Platform.Android\\AppCompat\\ButtonRenderer.cs:261\r\n>   at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (IntPtr jnienv, IntPtr native__this, IntPtr native_v) [0x00011] in /Users/builder/data/lanes/3415/7db2aac3/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.View.cs:1806\r\n>   at at (wrapper dynamic-method) System.Object:efa38258-6397-42b4-862f-3f6eaaac9efc (intptr,intptr,intptr)\r\n"}}
{"actor":{"display_login":"amay077"}}