Metro app crashes when Background Task fires RRS feed

  • Question

  • I'm trying to create a simple BackgroundTask to post a toast notification on a system event (timezone change, network change etc). The sample (BackgroundTaskSample, from the MS Metro samples download) runs fine on my machine, but if I take the exact same sample code and create a new task class in a new project the app crashes w/ return code 1 when the task fires. I'm not sure how to troubleshoot it.

    • I added a new project to the sample solution BackgroundTaskSample
    • Project has a single class that implements IBackgroundTask, with contents exactly the same as in the sample BackgroundTask
    • Added the new project as a dependency in the solution properties
    • Project builds as a WinMD file
    • Edited the sample code to point at the new class when registering the task (MainPage.SampleBackgroundTaskEntryPoint)
    • Edited the package.appxmanifest file to point at the new class in the Declarations

    I've pored over the various spots for configuring build properties, etc. and can't see any differences between the new project and the sample. 

    One difference I've seen is that my new winmd file is not getting copied to the AppX directory, and it isn't listed in the vs.appxrecipe file (the sample BackgroundTask.winmd is, though). I'm not sure how that file gets generated - this seems like it's probably related.

    Any thoughts on troubleshooting this? How can I tell what's going on in backgroundTaskHost.exe?



    Saturday, March 31, 2012 12:49 AM