Element not found on BackgroundExecutionManager.RequestAccessAsync()

hairpull

This was me this morning…pulling my hair out, trying to work out why I was getting the following error: "Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND))" when I called await BackgroundExecutionManager.RequestAccessAsync().

I still don’t know exactly WHY it happens but I found if i had a breakpoint on a line of code (any line..didn’t matter) ABOVE that call in a function it would break no matter what I did.

Move the breakpoint below – all good. Remove the breakpoint altogether – all good.

Hoping this helps anyone else out hitting the same problem. Also if you can tell answer WHY this happens would be much appreciated.