Bug 32688 - CLLocation Async calls hang application
Summary: CLLocation Async calls hang application
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 8.10
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-08-01 13:28 UTC by Auri Rahimzadeh
Modified: 2016-06-09 00:42 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Auri Rahimzadeh 2015-08-01 13:28:05 UTC
Any CLLocation Async call I try causes the application to hang. However, those functions that require a delegate continue to work.

The following code will hang upon the .Result request:

			using (CLGeocoder gc = new CLGeocoder ()) {
				using (var location = new CLLocation ()) {
					var data = gc.GeocodeAddressAsync(address).Result; // instant hang
					if (data != null && data.Length > 0) {
						return new Tuple<string, double, double, string> (
							data [0].Name + " " + data [0].PostalCode,
							data [0].Location.Coordinate.Latitude,
							data [0].Location.Coordinate.Longitude,
							data [0].PostalCode
					return null;

The same goes for the ReverseGeocodeLocationAsync().Result.

What's going on, please?

Thanks and Best,


Additional Details:

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: 1f65d629-9194-4327-85da-0423582d073b
	Mono 4.0.2 ((detached/c99aa0c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400020005

=== Apple Developer Tools ===

Xcode 6.4 (7720)
Build 6E35b

=== Xamarin.iOS ===

Version: (Indie Edition)
Hash: 8b265d6
Branch: master
Build date: 2015-06-30 15:19:13-0400

=== Xamarin.Android ===

Version: (Indie Edition)
Android SDK: /Users/auri/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.2   (API level 17)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.10.4
Darwin Auris-MacBook-Air.local 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-08-03 04:08:46 UTC
Are you running this on the main thread or in a background thread? What happens if you run it in a background thread?
Comment 2 Auri Rahimzadeh 2015-08-04 08:35:45 UTC
I have not tried that. Simply using await at this time. I can try it, but not feeling I'll get different results. Haven't taken a look at the MonoTouch code- day job, you know :)

It'll be a few days before I can look. Any ideas while we wait, please?

Thanks and Best,

Comment 3 Rolf Bjarne Kvinge [MSFT] 2015-08-04 12:28:39 UTC
You're not using await, you're doing the call synchronously:

> var data = gc.GeocodeAddressAsync(address).Result;

if that happens on the main thread, it'll block waiting for the main thread to process the request, which can't happen because you're already waiting on the main thread for it to complete.
Comment 4 Sebastien Pouliot 2016-06-09 00:42:09 UTC
We have not received the confirmation about our last comment. If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!