microsoft / steps

Lumia SensorCore SDK sample for Pedometer and Step Counter APIs.
33 stars 114 forks source link

App crashing when launching from SecondaryTile #9

Open 1100101 opened 8 years ago

1100101 commented 8 years ago

I've built the latest release (master) of the sample code with VS2015 Community and deployed it to a Lumia 830 running the latest version of Windows 10 mobile.

When I pin the step counter to the start screen, then go to the start screen and tap the newly available tile, the app seems to launch, but immediately quits again. The same happens if I switch from the app to another app using the app switcher, and then try to switch back to the Steps app.

What's weird: When debugging (no matter using Debug or release builds), this does not happen.

How can I find out what's going wrong?

1100101 commented 8 years ago

The crash generally happens if the app is running, and you try to run it again/switch to it. It doesn't matter if the app is pinned or not.

EdiWang commented 8 years ago

@1100101

I met the same problem. It happens only to my Lumia 640, my Lumia 950XL is good. It seems to be the

public static IStepsEngine Engine { get; private set; }

in app.xaml.cs, comment out

Engine = await StepsEngineFactory.GetDefaultAsync();

add try..catch to necessary places, the steps won't work, but the crashing on secondary launch is gone, the app won't crash when being switched to or being launched by secondary tile..

I thought it is the problem with static keyword. So I tried to create a Singleton class to initiate the Engine, but the same crashing occurs.

I am still investigating the issue. As far as I can find, commenting out

stepsEngine = new LumiaStepsEngine();

in StepsEngineFactory will also fix the crashing, but step counter certainly won't work. It's difficult to debug because in debug mode everything is fine. Even the "UnhandledException" in app.xaml.cs won't fire.

EdiWang commented 8 years ago

Update: seems to be the problem with "today", if choosing the day to yesterday and then switch to another app or start screen, then switch back to Steps, it won't crash. But when you choose to today, the app will crash again.

Still investigating...