WP7的烤机测试

4
我在开发WP7应用时遇到了非常奇怪的问题,通常在30分钟或1小时后会出现,尽管代码非常简单,几乎等同于示例。模拟器没有任何问题。
以下是问题列表:
- 应用程序崩溃,没有抛出任何异常。 - 未处理的异常:{"0xffffffff"}(是的,消息是“0xffffffff”。而且堆栈跟踪为null)。 - 一次在获取DateTimeOffset.Now属性时引发异常! - 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个小时。

1个回答

2
我会怀疑是内存(或资源)泄漏引起的问题。 这个应用程序是做什么的? 错误发生时,您是在使用应用程序还是只是让它运行? 应用程序是否在计时器上执行任何操作? 您是否尝试监控应用程序的内存使用情况? 由于模拟器中没有其他应用程序和后台任务,因此系统从您的应用程序中回收资源的需求可能要少得多。因此,这样的问题在模拟器上可能也不会出现。 如果您获取最新的(beta)[芒果]开发人员工具版本,则可以通过新的内置分析器运行代码,以便随时间查看发生了什么。

谢谢您的回复。我已经发布了代码。该应用程序只在屏幕上显示传感器数据。 要使用最新SDK上的分析器,我必须针对7.1进行目标设置,因此无法在设备上运行,该设备为7.0。 - Zmaster

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接