开发者

Burn-in test for WP7

I'm experiencing very strange issues while developing a WP7 app that happen usually after 30m or 1h, despite the code is really simple, almost equal to examples. The emulator does not have any problem.

  • app crashes with no exception being thrown
  • unhandled exception: {"0xffffffff"} (Yes, message is "0xffffffff". And Stacktrace is null)
  • once i got an exception thrown while getting DateTimeOffset.Now property (!)
  • UI Thread frozen, couldn't terminate app, had to power cycle the device

So at this point i think that either WP7 is really unstable or my device hardware is faulty.

Does a burn-in test exists for WP7? Like Memtest86, Prime and other utilities for the desktop?


Edit: here is the code that is causing problems:

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>

EDIT: As i suspected the phone was faulty. The app had run properly on anoth开发者_高级运维er device for 5 hours.


I would suspect a memory (or resource) leak.
What does the app do?
Does the error happen while using the app or if you just leave it? Is the app doing anything on a timer?
Have you tried monitoring memory usage over the lifetime of the app?

As there are fewer other apps and things going on in the background with the emulator, the need for the system to reclaim resources from you app is likley to be much less. It is therefore possible that such issues may not also be seen on the emulator.

If you get the latest (beta) version of the [mango] developer tools you'll be able to run your code through the new, built in profiler so you can see what is happening over time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜