title: Xamarin.Forms updating UI thread behaving strangely in iOS & Android
body: <p>I am using async, await to update UI on button click to indicate user that some progress is going on and I am showing loading panel onclick of button. Below is my code:</p>
  
  <p><strong>Android:</strong></p>
  
  <pre><code>async void loginButtonGesture_Tapped(object sender, EventArgs e)
  {            
      try
      {
      DependencyService.Get&lt;Idevice&gt;().StartLoading();
          await AsyncUpdateStatus();
      }
  }
  
  
  private async Task AsyncUpdateStatus()
  {
              try
              {
                  await Task.Run(() =&gt;
                  {
                        //Device.BeginInvokeOnMainThread is used in places to stop loading the screen
                  });
             }
  }
  </code></pre>
  
  <p><strong>iOS:</strong></p>
  
  <pre><code>async void loginButtonGesture_Tapped(object sender, EventArgs e)
      {            
          try
          {
          DependencyService.Get&lt;Idevice&gt;().StartLoading();
              await Task.Delay(40); //Required for iOS, otherwise loading panel is keep on running
              await AsyncUpdateStatus();
          }
      }
  
  
      private async Task AsyncUpdateStatus()
      {
                  try
                  {
  
                       //await Task.Run(() =&gt; Enabling new thread also not working
                      //Device.BeginInvokeOnMainThread is used in places to stop loading the screen
  
                 }
      }
  </code></pre>
  
  <p>Both Android &amp; iOS is sharing same Forms code. But for this particular case its working conditionally. iOS is working after adding <code>Task.Delay(40)</code> and commenting <code>Task.Run(() =&gt; {});</code> thread.</p>
  
  <p>Why its so? But if I do above modification in Android, it is not working. What exactly is happening?</p>