{"action":"created","issue":{"url":"https://api.github.com/repos/Mapsui/Mapsui/issues/606","repository_url":"https://api.github.com/repos/Mapsui/Mapsui","labels_url":"https://api.github.com/repos/Mapsui/Mapsui/issues/606/labels{/name}","comments_url":"https://api.github.com/repos/Mapsui/Mapsui/issues/606/comments","events_url":"https://api.github.com/repos/Mapsui/Mapsui/issues/606/events","html_url":"https://github.com/Mapsui/Mapsui/issues/606","id":412430486,"node_id":"MDU6SXNzdWU0MTI0MzA0ODY=","number":606,"title":"Accessing Pin.Callout leads into endless loop with latest Xamarin.Forms","user":{"login":"mmichelbb","id":24935832,"node_id":"MDQ6VXNlcjI0OTM1ODMy","avatar_url":"https://avatars3.githubusercontent.com/u/24935832?v=4","gravatar_id":"","url":"https://api.github.com/users/mmichelbb","html_url":"https://github.com/mmichelbb","followers_url":"https://api.github.com/users/mmichelbb/followers","following_url":"https://api.github.com/users/mmichelbb/following{/other_user}","gists_url":"https://api.github.com/users/mmichelbb/gists{/gist_id}","starred_url":"https://api.github.com/users/mmichelbb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmichelbb/subscriptions","organizations_url":"https://api.github.com/users/mmichelbb/orgs","repos_url":"https://api.github.com/users/mmichelbb/repos","events_url":"https://api.github.com/users/mmichelbb/events{/privacy}","received_events_url":"https://api.github.com/users/mmichelbb/received_events","type":"User","site_admin":false},"labels":[{"id":599186938,"node_id":"MDU6TGFiZWw1OTkxODY5Mzg=","url":"https://api.github.com/repos/Mapsui/Mapsui/labels/possible%20bug","name":"possible bug","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":32,"created_at":"2019-02-20T13:40:04Z","updated_at":"2019-03-12T18:29:38Z","closed_at":null,"author_association":"NONE","body":"I have compiled Mapsui.Forms against the latest version of Xamarin.Forms. \r\nWhenever I tried accessing the Callout on a pin (doing it the way as described in Forms.Shared PinSample), my app got stuck in an infinity loop and therefore doing nothing anymore.\r\n\r\nI suspect that this is caused by line 457 in Mapsui.UI.Forms.MapView.cs:\r\n`while (_callout == null) ;`\r\n\r\nFor now my solution is to create and populate the callout manually using reflection and injecting it into Pin._callout afterwards, so that MapView._callout is never called in the first place.\r\n\r\nHere is the code I am using to populate the pins:\r\n\r\n`\r\n\t\tprivate Pin CreatePin(MapView mapView, int pinNumber, string label, string address, double latitude, double longitude, IconTypes iconType)\r\n\t\t{\r\n\t\t\tvar assembly = typeof(App).GetTypeInfo().Assembly;\r\n\t\t\tPosition position = new Mapsui.UI.Forms.Position(latitude, longitude);\r\n\t\t\tPin pin = new Pin(mapView)\r\n\t\t\t{\r\n\t\t\t\tLabel = label,\r\n\t\t\t\tAddress = address,\r\n\t\t\t\tPosition = position,\r\n\t\t\t\tIsVisible = true,\r\n\t\t\t\tType = PinType.Icon,\r\n\t\t\t\tScale = 0.3f,\r\n\t\t\t\tTransparency = 0f\r\n\t\t\t};\r\n\r\n\t\t\tpin.Icon = assembly.GetManifestResourceStream(iconType.ToAssemblyFile()).ToBytes();\r\n\t\t\tpin.Feature.Geometry = SphericalMercator.FromLonLat(position.Longitude, position.Latitude);\r\n\t\t\tpin.Feature[\"name\"] = label;\r\n\r\n\t\t\t//hack to ensure that _mapView.CreateCallout doesn't get called because Pin._callout is not null\r\n\t\t\tFieldInfo privateCalloutProp = pin.GetType().GetField(\"_callout\", BindingFlags.NonPublic | BindingFlags.Instance);\r\n\t\t\tif (privateCalloutProp != null)\r\n\t\t\t{\r\n\t\t\t\tFieldInfo mapControlProp = mapView.GetType().GetField(\"_mapControl\", BindingFlags.NonPublic | BindingFlags.Instance);\r\n\t\t\t\tif (mapControlProp != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tCallout callout = new Callout((MapControl)mapControlProp.GetValue(mapView))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tRectRadius = 5,\r\n\t\t\t\t\t\tArrowHeight = 20,\r\n\t\t\t\t\t\tArrowWidth = 20,\r\n\t\t\t\t\t\tArrowAlignment = ArrowAlignment.Top,\r\n\t\t\t\t\t\tArrowPosition = 0.5f,\r\n\t\t\t\t\t\tTitle = label,\r\n\t\t\t\t\t\tSubtitle = address,\r\n\t\t\t\t\t\tType = !string.IsNullOrEmpty(address) ? CalloutType.Detail : CalloutType.Single\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif (!string.IsNullOrEmpty(address))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcallout.SubtitleLabel.LineBreakMode = Xamarin.Forms.LineBreakMode.WordWrap;\r\n\t\t\t\t\t\tcallout.SubtitleLabel.HorizontalOptions = LayoutOptions.StartAndExpand;\r\n\t\t\t\t\t\tcallout.SubtitleLabel.FontSize = 12;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tprivateCalloutProp.SetValue(pin, callout);\r\n\t\t\t\t\tpin.CalloutAnchor = new Point(0, -20);\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\treturn pin;\r\n\t\t}\r\n`"},"comment":{"url":"https://api.github.com/repos/Mapsui/Mapsui/issues/comments/472126840","html_url":"https://github.com/Mapsui/Mapsui/issues/606#issuecomment-472126840","issue_url":"https://api.github.com/repos/Mapsui/Mapsui/issues/606","id":472126840,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3MjEyNjg0MA==","user":{"login":"charlenni","id":4381223,"node_id":"MDQ6VXNlcjQzODEyMjM=","avatar_url":"https://avatars2.githubusercontent.com/u/4381223?v=4","gravatar_id":"","url":"https://api.github.com/users/charlenni","html_url":"https://github.com/charlenni","followers_url":"https://api.github.com/users/charlenni/followers","following_url":"https://api.github.com/users/charlenni/following{/other_user}","gists_url":"https://api.github.com/users/charlenni/gists{/gist_id}","starred_url":"https://api.github.com/users/charlenni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charlenni/subscriptions","organizations_url":"https://api.github.com/users/charlenni/orgs","repos_url":"https://api.github.com/users/charlenni/repos","events_url":"https://api.github.com/users/charlenni/events{/privacy}","received_events_url":"https://api.github.com/users/charlenni/received_events","type":"User","site_admin":false},"created_at":"2019-03-12T18:29:38Z","updated_at":"2019-03-12T18:29:38Z","author_association":"CONTRIBUTOR","body":"![grafik](https://user-images.githubusercontent.com/4381223/54226002-29c98c80-44fd-11e9-8b60-f26918f7fec8.png)\r\n"}}
{"actor":{"display_login":"charlenni"}}