部署后WP7 App退出 [英] WP7 App exits when deployed

查看:89
本文介绍了部署后WP7 App退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发WP7应用程序,该应用程序包含带有Bing Maps的"Locate Me"样式功能.

I've been developing a WP7 app that includes "Locate Me" style functionality with Bing Maps.

我有一个早期的WP7原型设备,可以毫无问题地进行部署.我的两个同事中有零售的WP7设备,当运行该应用程序时,它总是在某个点退出.

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();
        }
    }

因为显示了有关Horizo​​ntalAccuracy的消息以及从反向地址解析获得的地址.

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.

通过Visual Studio 2010调试应用程序时,两种设备均可正常工作.

Both devices work fine when debugging the app through Visual Studio 2010.

我能想到的是,在连接到计算机时,设备正在通过USB电缆使用Internet连接,但是在断开连接时,设备正在使用蜂窝数据.但是我不知道为什么这会使它退出.

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?

更新

我已按照建议实施了全局错误处理,并收到以下错误: 凭据在无效的2台设备上无效或未指定.但是,如上所述,仅在部署时,而不是在通过Visual Studio运行时.

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 Visual Studio.

推荐答案

至少对于UI线程,您是否具有全局异常处理程序?您可能想要在版本内部包含一个显示礼貌的错误消息的信息,并提供调试版本的异常的详细信息.

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:

  • 在其他线程上引发的异常
  • 不可恢复的异常,例如堆栈溢出错误

如果您从VS2010中启动但未进行调试-它仍在使用USB连接-它仍然会崩溃吗?

If you launch it from VS2010 but without debugging - so it's still using the USB connection - does it still crash?

这篇关于部署后WP7 App退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆