title: Background task with entry point XX and name XX can not activate; error code: 0x80131509
body: <p>I have an UWP app with a simple background task wich I want to be executed when the user starts session in Windows 10 (Anniversary Update). </p>
  
  <p>I registered the task and can see it in powershell using "Get-AppBackgroundTask". The problem is the task is not executing when user starts session. Here is task registration code:</p>
  
  <pre><code>var status = await BackgroundExecutionManager.RequestAccessAsync();
  bool accessgranted = status != BackgroundAccessStatus.DeniedByUser
          &amp;&amp; status != BackgroundAccessStatus.DeniedBySystemPolicy
          &amp;&amp; status != BackgroundAccessStatus.Unspecified;
  
  if (accessgranted)
  {
      await RegisterTask("MyBgTask", 
          typeof(BgStartTask).FullName, 
          new SystemTrigger(SystemTriggerType.SessionConnected, false));
  }
  
  
  private async Task&lt;IBackgroundTaskRegistration&gt; RegisterTask(string taskName, string entryPoint, IBackgroundTrigger trigger)
  {
      var builder = new BackgroundTaskBuilder
          {
              Name = taskName,
              TaskEntryPoint = entryPoint,
              IsNetworkRequested = true
          };
      builder.SetTrigger(trigger);
  
      var taskRegistration = builder.Register();
      return taskRegistration;
  }
  </code></pre>
  
  <p>Here is the complete check of actions made:</p>
  
  <ul>
  <li>Added the refference of BgStartTask project to my uwp app.</li>
  <li>Added entrypoint in apppackagemanifest.</li>
  </ul>
  
  <p>When I start session I can see in event viewer the following error under "BackgroundTaskInfraestructure->Operational":</p>
  
  <p><strong>Background task with entrypoint StartTask.BgStartTask and name MyBgTask can not activate; error code: 0x80131509.</strong></p>
  
  <p>I've tried to re-register the task with no success. Also, if I execute the task from VS 2017 it works ok...
  Any ideas please?</p>