title: Why does async await throw a NullReferenceException?
body: <p>My code looks something like this</p>
  
  <pre><code>var userStartTask = LroMdmApiService.AddUser(user);
   // .... do some stuff
  await userStartTask;
  </code></pre>
  
  <p>When <code>AddUser()</code> throws an exception, it bubbles up as a <code>NullReferenceException</code>.  It doesn't wait for await.</p>
  
  <p>But if I structure the code like this...</p>
  
  <pre><code>var result = await LroMdmApiService.AddUser(user);
  </code></pre>
  
  <p>Then exceptions get caught properly. Can someone tell me what's going on here?</p>
  
  <p>Here is complete code that shows the issue.  What is the best practice for such a scenario?</p>
  
  <pre><code>class Program
  {
      private static void Main(string[] args)
      {
          CallAsync();
          Console.ReadKey();
      }
  
      public static async void CallAsync()
      {
          var task = CallExceptionAsync();
          ThrowException("Outside");
          await task;
      }
  
      public static Task CallExceptionAsync()
      {
          return Task.Run(() =&gt;
          {
              ThrowException("Inside");
          });
  
      }
  
      public static void ThrowException(string msg)
      {
          throw new Exception(msg);
      }        
  }
  </code></pre>