2011-05-28 82 views
4

尽管代码非常简单,几乎等于示例,但我在开发通常在30m或1h后发生的WP7应用时遇到了很奇怪的问题。模拟器没有任何问题。WP7的老化测试

  • 没有例外的应用程序崩溃被抛出
  • 未处理的异常:{“0xffffffff的”}(是的,消息是“0xffffffff的”和堆栈跟踪是空的。)
  • 一旦我得到了,而获取的DateTimeOffset抛出的异常。现在财产(!)
  • UI线程冻结,无法终止应用程序,不得不电源循环设备

所以在这一点上,我认为,要么WP7确实是不稳定的或我的设备硬件故障。

是否存在对WP7的老化测试?像Memtest86,Prime和桌面的其他实用程序?


编辑:这里是导致问题的代码:

public partial class MainPage : PhoneApplicationPage 
{ 
    private Accelerometer _accelerometer; 
    private GeoCoordinateWatcher _gps; 

    public MainPage() 
    { 
     InitializeComponent(); 

     _accelerometer = new Accelerometer(); 
     _accelerometer.ReadingChanged += new EventHandler<AccelerometerReadingEventArgs>(_accelerometer_ReadingChanged); 
     _accelerometer.Start(); 

     _gps = new GeoCoordinateWatcher(GeoPositionAccuracy.High); 
     _gps.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(_gps_PositionChanged); 
     _gps.Start(); 
    } 

    void _gps_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e) 
    { 
     Dispatcher.BeginInvoke(() => 
     { 
      TBLocation.Text = e.Position.Location.ToString(); 
     }); 
    } 

    void _accelerometer_ReadingChanged(object sender, AccelerometerReadingEventArgs e) 
    { 
     Dispatcher.BeginInvoke(() => 
     { 
      TBAccelX.Text = string.Format("X: {0:F2} g", e.X); 
      TBAccelY.Text = string.Format("Y: {0:F2} g", e.Y); 
     }); 
    } 
} 
<phone:PhoneApplicationPage 
    x:Class="AccelerometerTest2.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}" 
    FontSize="{StaticResource PhoneFontSizeNormal}" 
    Foreground="{StaticResource PhoneForegroundBrush}" 
    SupportedOrientations="Portrait" Orientation="Portrait" 
    shell:SystemTray.IsVisible="True"> 

    <StackPanel> 
     <TextBlock Name="TBAccelX"/> 
     <TextBlock Name="TBAccelY"/> 
     <TextBlock Name="TBLocation"/> 
    </StackPanel> 

</phone:PhoneApplicationPage> 

编辑:正如我怀疑电话是错误的。该应用程序已在另一台设备上正常运行5个小时。

回答

2

我会怀疑内存(或资源)泄漏。
该应用做什么?
在使用应用程序时是否发生错误,或者您是否放弃它? 应用程序是否在计时器上执行任何操作?
您是否尝试过在应用程序的生命周期内监视内存使用情况?

由于使用模拟器后台中的其他应用程序和事件较少,因此系统从您应用程序回收资源的需求可能会少得多。因此,仿真器上可能无法看到这些问题。

如果您获得[mango]开发人员工具的最新(测试版)版本,您将可以通过新的内置分析器运行代码,以便随时查看发生的情况。

+0

谢谢你的回复。我发布了代码。该应用程序只显示屏幕上的传感器数据。 要在最新SDK上使用探查器,我必须以7.1为目标,所以我无法在7.0版本的设备上运行。 – Zmaster 2011-05-31 19:51:44