When I try to launch a particular background task using Visual Studio, I currently receive the following error:
I tried pressing the Help button, which took me to How to trigger suspend, resume, and background events in Windows Store apps. The page said to look at a certain section in Event Viewer that didn't contain any entries.
The corresponding Windows Store application is both requesting background task permission and registering the task. The application is enabled for the lock screen. The application's project is referencing the background task project, and its manifest is specifying the correct fully-qualified class name of the background task. The correct type of background task has been specified in the manifest.
I was able to resolve this by changing the task registration/location code to call RequestAccessAsync
before registering the background task. (Previously, it had registered the background task before asking for access.)
For some reason, this caused the application to request access again. After running the application and granting it permission, I reverted the code back to the previous state.
Now it works correctly again even though the code is the same as it was originally.
For me, I had a problem where I had updated TaskEntryPoint
in my manifest but forgot to update it in my code... Frustrating to have to maintain it both places!
It got out of sync via the process of refactoring some classes into a new library, so don't forget to update after the fact if you do that!
You may be able to use reflection to help with this e.g. typeof(LocationTask).FullName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With