调试时 WP7 应用程序仅在模拟器和设备上运行
我的 WP7 应用程序有问题,它在模拟器上运行良好,在设备上也运行良好,但仅限于调试时。当我在未调试的情况下运行应用程序时,应用程序将终止。没有例外……什么也没有。 我不知道到底是哪个部分造成的。该应用程序正在调用 Web 服务、Bing 地图服务并使用 GPS 信息。 有什么想法吗?
I have a problem with my WP7 application, it's working fine on the emulator and it's also working fine on the device but only when debugging. When I run the application when it's not debugging the application is terminated. No exception...nothing.
I can not tell what part is actually causing that. The application is calling web services, bing map services and using GPS information.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您在启动过程中是否做了任何昂贵或同步的事情?
在操作系统杀死应用程序之前,您有一定的时间来启动应用程序。如果附加了调试器,您就可以不受时间限制。在模拟器上,计算机的处理器速度可能使其启动速度比在设备上更快。
我会开始简化您的应用程序启动,看看这是否是其中的一部分。
Are you doing anything expensive or synchronous during your startup?
You have a certain amount of time for your app to start up before the OS kills it. with a debugger attached, you're exempted from the time limit. On the emulator, your computer's processor speed might make allow it to start up faster than it would on the device.
I'd start simplifying your app startup and see if that's part of it.
尝试在执行启动步骤时将一些日志记录写入独立存储中的文件,以查看您的应用程序在崩溃之前走了多远。您可以将其与在调试模式下运行时的日志输出进行比较。
Try writing some logging to a file in isolated storage as startup steps are executed to see how far your app is getting before it crashes. You can compare this to the log output when you run in debug mode.
我发现,如果变量不在正确的范围内(如代码中的错误),它可以在手机上的模拟器/调试中工作,但不会在手机上正常运行。确保您的网络服务在尽可能的最高级别声明(页面公开)。
I have found that if a variable is not at the correct scope (as in a bug in your code), it can work in the emulator / debug on the phone, but won't run normally on the phone. Ensure your webservice is declared at the highest level possible (public for the page).
我曾经花了几个小时试图在非常相似的情况下确定我的应用程序出了什么问题,结果证明退出 Visual Studio 并重新启动它就解决了问题。 :(
克里斯
I once spent hours trying to establish what was wrong with my app in a very similar situation, and it turned out that quitting Visual Studio and restarting it solved it. :(
Chris