WP7应用程序部署后退出

发布于 2024-10-05 10:00:34 字数 1293 浏览 0 评论 0原文

我一直在开发一个 WP7 应用程序,其中包含 Bing 地图的“定位我”风格功能。

我有一个早期的 WP7 设备原型,我可以毫无问题地部署到它。我的 2 位同事拥有零售 WP7 设备,运行应用程序时它总是在某个时刻退出。

我假设崩溃发生在这部分代码中:

    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 的消息以及从反向地理编码获得的地址。

然而,地图只是变白(就好像它将开始以位置为中心),然后应用程序退出。

通过 Visual Studio 2010 调试应用程序时,这两种设备都工作正常。

我所能想到的是,在连接到我的计算机时,设备通过 USB 电缆使用互联网连接,但在断开连接时使用蜂窝数据。但是我无法想象为什么这会使其退出。

由于两者都在调试时工作,我如何继续追踪问题?

更新

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏日落 2024-10-12 10:00:34

您是否有全局异常处理程序(至少对于 UI 线程而言)?您可能希望包含一个在发布版本中显示礼貌错误消息的消息,以及调试版本中的异常详细信息。

这对以下情况没有帮助:

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

如果您从 VS2010 启动它但没有进行调试 - 所以它仍然使用 USB 连接 - 它还会崩溃吗?

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?

别念他 2024-10-12 10:00:34

Bing 地图凭据有问题吗?

 <my:Map 
        Margin="6"
        CredentialsProvider="{StaticResource BingCredentials}">

ETC。

Something wrong with Bing Maps credentials?

 <my:Map 
        Margin="6"
        CredentialsProvider="{StaticResource BingCredentials}">

etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文