Bug 7432 - Unhandled Exception occurs from GetFromLocation when switching app to Airplane mode fom ON to OFF
Summary: Unhandled Exception occurs from GetFromLocation when switching app to Airplan...
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.2.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-09-24 18:26 UTC by hani
Modified: 2013-12-05 18:34 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 hani 2012-09-24 18:26:09 UTC
I have the following code, the Try/Catch statements don't occur and the app crashes.  I tracked the crash to GetFromLocation.  Can you fix to either allow the Try/Catch to work or return a null/blank object

The crash occurs when the phone can't communicate with the Google or when I switch the Airplane mode from On/Off and the phone can communicate again.



public void OnLocationChanged(Location location) {

   try {
      if (Math.Abs(location.Latitude) > 180) {
        location.Latitude = location.Latitude / 1E6;
      if (Math.Abs(location.Longitude) > 180) {
	location.Longitude = location.Longitude / 1E6;
      try {
	var x = mGeoCoder.GetFromLocation(location.Latitude, location.Longitude, 1);
	Android.Locations.Address addr = null;
	if (x != null) {
	   addr = x.FirstOrDefault();

	if (addr != null) {
	   Console.WriteLine(string.Format(" -> {0} {1}", addr.SubThoroughfare, addr.Thoroughfare));
      } catch (Java.Lang.Exception ex) {
   } catch (IOException io) {
      Android.Util.Log.Debug("LocationActivity", io.Message);

Comment 1 Jonathan Pryor 2013-05-23 14:04:05 UTC
Is it hanging? Is it crashing?

Could you please provide the `adb logcat` output for when this occurs?
Comment 2 hani 2013-05-23 14:15:05 UTC
Issue has been resolved with one of the updates, don't recall when now
Comment 3 PJ 2013-11-19 17:04:46 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 4 PJ 2013-12-05 18:34:55 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.