WP7 App exits when deployed
I've been developing a WP7 app that includes "Locate Me" style functionality with Bing Maps.
I have an early prototype WP7 device and I can deploy to this no problem. 2 of my collegues have retail WP7 devices and when running the app it always exits at a certain point.
I assume the crash occurs within this section of code:
void UpdateMap(GeoPosition<GeoCoordinate> position, double zoom)
{
_foundLocation = position;
mapLocation.Center = position.Location;
mapLocation.ZoomLevel = zoom;
txtStatus.Text = "Found you within " + position.Location.HorizontalAccuracy.ToString(AccuracyFormat) + " meters";
//Display address to user
DisplayLocationAddress(position.Location.Latitude, position.Location.Longitude);
//Stop the watcher if horizontal accuracy is high enough for requirements to converse battery power.
if (watcher != null && watcher.Position.Location.HorizontalAccuracy <= DesiredAccuracy)
{
watcher.Stop();
}
}
Because the message concerning HorizontalAccuracy is displayed as well as the address obtained from reverse geocode.
However the map just goes white (as if it is about to start centering on Location) and then the app exits.
Both devices work fine when debugging the app through Visual Studio 2010.
All I can think is that whilst connected to my computer the devices are using the internet connection through the USB cable but when disconnected are using cellular data. However I can't think why this would make it exit.
As both work whilst debugging how can I proceed to track down the problem?
UPDATE
I've implemented global error handling as suggested and am getting the following error: Credentials are either invalid or unspecified on the 2 devices that aren't working. However as mentioned above only when deployed, not when running through V开发者_StackOverflowisual Studio.
Do you have a global exception handler, at least for the UI thread? You might want to include one which shows a polite error message in a release build, and the details of the exception for debug builds.
That won't help for:
- Exceptions thrown on other threads
- Unrecoverable exceptions such as stack overflow errors
If you launch it from VS2010 but without debugging - so it's still using the USB connection - does it still crash?
Something wrong with Bing Maps credentials?
<my:Map
Margin="6"
CredentialsProvider="{StaticResource BingCredentials}">
etc.
精彩评论