locked
RequestAccessAsync Element not found exception RRS feed

  • Question

  • When I call this line:

    BackgroundAccessStatus status = await BackgroundExecutionManager.RequestAccessAsync();

    I get this exception:

    System.Exception occurred
      HResult=-2147319765
      Message=Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND))
      Source=Windows.ApplicationModel.Background

    It was working perfectly just a few minutes before this problem occurred.  It is called just after my ViewModel has been loaded - even though it doesn't probably need to be (as it has already been requested), as part of updating the background tasks (which seem to keep disappearing).  I can easily restructure my code not call it at this point, but even if I call it in response to the Pin button being pressed, the same problem occurs.   At some point I will reboot, which may resolve the problem, but hopefully the exception can be made clearer for future releases.  I will post again if the problem continues after a reboot.

    So, is there a clearer explanation as to why this exception occurs?

    ...Stefan

    Tuesday, May 1, 2012 6:39 AM

Answers

  • Yes, this is a known issue.  If the user has already accepted the LockScreen access then this exception is thrown.  This should be fixed in newer versions.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator

    Tuesday, May 1, 2012 3:26 PM
    Moderator

All replies

  • Yes, this is a known issue.  If the user has already accepted the LockScreen access then this exception is thrown.  This should be fixed in newer versions.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator

    Tuesday, May 1, 2012 3:26 PM
    Moderator
  • Great, thanks!
    Tuesday, May 1, 2012 6:17 PM
  • but it also have this error in the vs2012 RC

    Wednesday, June 6, 2012 8:11 AM
  • So am I. (8427.WinMain)
    Monday, June 11, 2012 3:07 PM
  • Same here (28/06/2012) - Been working totally fine in development over the past week until right now.

    Any workarounds so we can keep working in the meantime?

    • Proposed as answer by Ashley Bowles Thursday, January 10, 2013 4:13 PM
    • Unproposed as answer by Ashley Bowles Thursday, January 10, 2013 4:14 PM
    Thursday, June 28, 2012 9:49 AM
  • When I set break point at my application, a exception occurs at BackgroundExecutionManager.RequestAccessAsync(), "Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND))".

    when I tried again, I found something interesting. this exception only occurs when I set a break point before BackgroundExecutionManager.RequestAccessAsync() (and the caller method), when I set a break point after that, it seems be OK, so please try to set break point after that executes .

    Thursday, July 5, 2012 12:34 AM
  • As Su Xiaolong pointed,

    "when I set a break point after that, it seems be OK"

    Worked for me too. I got the dialog displayed.

    Sunday, July 8, 2012 7:31 PM
  • Hi, 

    I also try the same idea and its working for me also , while this is very strange but i think some problem associated with the Beta release.

    • Proposed as answer by Utsav_Vishnoi Wednesday, September 12, 2012 7:02 AM
    • Unproposed as answer by StefanOlson Wednesday, September 12, 2012 7:23 AM
    Wednesday, September 12, 2012 7:02 AM
  • When I set break point at my application, a exception occurs at BackgroundExecutionManager.RequestAccessAsync(), "Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND))".

    when I tried again, I found something interesting. this exception only occurs when I set a break point before BackgroundExecutionManager.RequestAccessAsync() (and the caller method), when I set a break point after that, it seems be OK, so please try to set break point after that executes .


    I concur on this. Breakpoint in the function before the call gives the exception for me too.

    Bronwen Zande - Soul Solutions Pty Ltd - Bing Maps MVP

    Wednesday, October 24, 2012 12:58 AM
  • I am using Visual Studio 2012 update 2 and breakpoint in the function before the call gives the exception for me too.
    Thursday, July 18, 2013 7:48 PM
  • As of Windows 8.1, this is no longer a bug. However, this error can still occur if you call the method too early in the pipeline. A Task.Delay(1000) before you call it seems to resolve it in every circumstance. But calling it more than once is no longer a problem. // Jerry

    Jerry Nixon

    Monday, May 12, 2014 2:12 AM