none
WP8 Regression - TryStarting the Gps hangs the UIThread for an amount equal to the timeout specified

    Question

  • In short : When i try to start the Gps ,with a timeout, inside my WP7 app running inside a WP8 phone then my UIThread hangs for an amount equal to the timeout (i.e 10 second timeout results in my UI hanging for 10 seconds before the Gps starts)


    The WP8 SDK has a bug
    in class :  System.Device.Location.GeoCoordinateWatcher
    in method :
    public bool TryStart(bool suppressPermissionPrompt, TimeSpan timeout);

    It takes the method an X amount of time to complete and X is always the same as the provided timeout. In order words the method always hangs the caller for the specified timeout amount.

    Note: the use of 100 seconds is purely for the purpose of highlighting the issue.

    On WP7 it works as expected : 

    But on WP8 it hangs :



    Tuesday, November 06, 2012 9:57 PM

All replies

  • The docs show that TryStart is synchronous, so it shouldn't ever be called with a 100 second timeout on a UI thread...

    Put it in a background thread...

    It could be that TryStart needs to pump data through the dispatcher to signal the completion in WP8. 

    Since you effectively are hung, it can't pump the completion and sits until your timeout wait period.


    Darin R.


    Tuesday, November 06, 2012 10:06 PM
  • Darin: That's a great point, but it doesn't change the fact that this is a serious big change since 7.1 (even when in quirks mode) and will significantly slow down acquisition of a GPS fix.

    /Morten
    twitter: http://www.twitter.com/dotMorten
    blog: http://www.sharpgis.net

    Friday, November 09, 2012 4:17 PM