title: App Doesn't Crash While Debugging, but Does When Running Normally
body: <blockquote>
    <p>System Information</p>
    
    <ul>
    <li>Windows 10 Technical Preview (build 9926)</li>
    <li>Visual Studio Community 2013<br/><br/>Attempting to debug on:</li>
    <li><em>[AT&amp;T]</em> Lumia 635 (Windows 10 Technical Preview for phones build 9941 w/ Lumia Cyan)</li>
    <li><em>[AT&amp;T]</em> Lumia 1520 (Windows Phone 8.1 with Lumia Denim and PfD)</li>
    <li><em>[Unlocked]</em> BLU Win Jr (Windows Phone 8.1 with PfD)</li>
    <li><em>[Verizon]</em> Lumia Icon (Windows Phone 8.1 with Lumia Denim and PfD)</li>
    </ul>
  </blockquote>
  
  <hr>
  
  <p>I trying to get location services working in my app.  Previously, I had Visual Studio throw the error.  It was an <code>ArgumentException</code> with the message "<code>Use of undefined keyword value 1 for event TaskScheduled in async</code>".  Googling didn't turn up any solutions.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>Geolocator Locator = new Geolocator();
  Geoposition Position = await Locator.GetGeopositionAsync();
  Geocoordinate Coordinate = Position.Coordinate;
  </code></pre>
  
  <p>When I could get the error to be thrown, the exception was thrown on the 2nd or 3rd line in the sample above.
  I simplified the original code to try and fix it, but this is the original:</p>
  
  <pre><code>Geolocator Locator = new Geolocator();
  Geocoordinate Coordinate = (await Locator.GetGeopositionAsync()).Position.Coordinate;
  </code></pre>
  
  <p>The entire app works when debugging, but crashes almost instantaneously otherwise.</p>
  
  <p>This is a Windows 8.1 Universal project, focusing on the phone project.</p>
  
  <p>Thanks in advance</p>
  
  <hr>
  
  <p><strong>EDIT:  As requested, here is the full method:</strong></p>
  
  <pre><code>private static bool CheckConnection()
  {
      ConnectionProfile connections = NetworkInformation.GetInternetConnectionProfile();
      bool internet = connections != null &amp;&amp; connections.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess;
      return internet;
  }
  public static async Task&lt;double&gt; GetTemperature(bool Force)
  {
      if (CheckConnection() || Force)
      {
          Geolocator Locator = new Geolocator();
          await Task.Yield(); //Error occurs here
          Geoposition Position = await Locator.GetGeopositionAsync();
          Geocoordinate Coordinate = Position.Coordinate;
          HttpClient Client = new HttpClient();
          double Temperature;
          Uri u = new Uri(string.Format("http://api.worldweatheronline.com/free/v1/weather.ashx?q={0},{1}&amp;format=xml&amp;num_of_days=1&amp;date=today&amp;cc=yes&amp;key={2}",
                                        Coordinate.Point.Position.Latitude,
                                        Coordinate.Point.Position.Longitude,
                                        "API KEY"),
                                        UriKind.Absolute);
          string Raw = await Client.GetStringAsync(u);
          XElement main = XElement.Parse(Raw), current_condition, temp_c;
          current_condition = main.Element("current_condition");
          temp_c = current_condition.Element("temp_C");
          Temperature = Convert.ToDouble(temp_c.Value);
          switch (Memory.TempUnit)
          {
              case 0:
                  Temperature = Convertions.Temperature.CelsiusToFahrenheit(Temperature);
                  break;
              case 2:
                  Temperature = Convertions.Temperature.CelsiusToKelvin(Temperature);
                  break;
          }
          return Temperature;
      }
      else
      {
          throw new InvalidOperationException("Cannot connect to the weather server.");
      }
  }
  </code></pre>
  
  <hr>
  
  <p><strong>EDIT 2:</strong> I've <a href="https://twitter.com/devgregw/status/564804691695919104" rel="nofollow">asked for help on Twitter</a>, and <a href="https://twitter.com/WinDevMatt/status/564872023139024897" rel="nofollow">received a reply</a> asking for a repro project.  I recreated the major portion of the original app, but I could not get the error.  However, errors may occur for you <a href="https://onedrive.live.com/redir?resid=CCFD696DFF6040C6!161538&amp;authkey=!AEwWmbv4EquRqTQ&amp;ithint=folder%2Czip" rel="nofollow">so here's the project</a>.</p>
  
  <hr>
  
  <p><strong>EDIT 3:  If it helps at all, here are the exception details:</strong></p>
  
  <pre><code>System.ArgumentException occurred
    _HResult=-2147024809
    _message=Use of undefined keyword value 1 for event TaskScheduled.
    HResult=-2147024809
    IsTransient=false
    Message=Use of undefined keyword value 1 for event TaskScheduled.
    Source=mscorlib
    StackTrace:
         at System.Diagnostics.Tracing.ManifestBuilder.GetKeywords(UInt64 keywords, String eventName)
    InnerException: 
  </code></pre>