title: BACKGROUNDTASKHOST.EXE' has exited with code 1 (0x1) - Geofence issue
body: <p>I am writing Windows Phone 8.1 Application using GeoFence API. My problem is that I can't trigger change of location in Background Task, because app exits with code 1.</p>
  
  <p>I have read multiple threads about this error, but no solution solved my problem.</p>
  
  <ul>
  <li>I have checked if my BackgroundTask is a Runtime Component, and it is.</li>
  <li>I have checked name of my class and it is correct.</li>
  <li>I have checked if I use any await function in my BackgroundTask function and I didn't find any.</li>
  <li>I have checked if I registered Background Task in app manifest and yes, I did (with entry point ofc)</li>
  </ul>
  
  <p>In fact error appears even before running Run function from BackgroundTask.</p>
  
  <pre><code>    namespace BackgroundTask
  {
      public sealed class geoFenceBackgroundTask : IBackgroundTask
      {
          public void Run(IBackgroundTaskInstance taskInstance)
          {
              ToastTemplateType toastTemplate = ToastTemplateType.ToastText02;
              XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);
  
              XmlNodeList toastTextElements = toastXml.GetElementsByTagName("text");
              toastTextElements[0].AppendChild(toastXml.CreateTextNode("MY APP"));
              toastTextElements[1].AppendChild(toastXml.CreateTextNode("Test"));
  
              //IXmlNode toastNode = toastXml.SelectSingleNode("/toast");
              //XmlElement audio = toastXml.CreateElement("audio");
  
              ToastNotification toast = new ToastNotification(toastXml);
              ToastNotificationManager.CreateToastNotifier().Show(toast);
          }
      }
  }
  </code></pre>
  
  <p>And my register function:</p>
  
  <pre><code>    async private void RegisterBackgroundTask()
          {
              // Get permission for a background task from the user. If the user has already answered once,
              // this does nothing and the user must manually update their preference via PC Settings.
              BackgroundAccessStatus backgroundAccessStatus = await BackgroundExecutionManager.RequestAccessAsync();
  
              // Regardless of the answer, register the background task. If the user later adds this application
              // to the lock screen, the background task will be ready to run.
              // Create a new background task builder
              BackgroundTaskBuilder geofenceTaskBuilder = new BackgroundTaskBuilder();
  
              geofenceTaskBuilder.Name = "geoFenceBackgroundTask";
              geofenceTaskBuilder.TaskEntryPoint = "BackgroundTask.geoFenceBackgroundTask";
  
              // Create a new location trigger
              var trigger = new LocationTrigger(LocationTriggerType.Geofence);
  
              // Associate the locationi trigger with the background task builder
              geofenceTaskBuilder.SetTrigger(trigger);
  
              // If it is important that there is user presence and/or
              // internet connection when OnCompleted is called
              // the following could be called before calling Register()
              // SystemCondition condition = new SystemCondition(SystemConditionType.UserPresent | SystemConditionType.InternetAvailable);
              // geofenceTaskBuilder.AddCondition(condition);
  
              // Register the background task
  
              var geofenceTask = geofenceTaskBuilder.Register();
              geofenceTask.Completed += (sender, args) =&gt;
              {
  // MY CODE HERE
  
              };
  
              geofenceTask = geofenceTaskBuilder.Register();            
          }
  </code></pre>
  
  <p>I have no other ideas. Any help?</p>