title: How run in the background a Task with F# on Xamarin.Forms?
body: <p>I'm triying to use a http server inside my android xamarin.forms app. It need to translate this C# code:</p>
  
  <pre><code>        var server = WebServer
              .Create(url)
              .EnableCors()
              .WithLocalSession()
              .WithStaticFolderAt("c:/web");
  
          var cts = new CancellationTokenSource();
          var task = server.RunAsync(cts.Token);
  
          Console.ReadKey(true);
          cts.Cancel();
  
          try
          {
              task.Wait();
          } catch (AggregateException)
          {
              // We'd also actually verify the exception cause was that the task
              // was cancelled.
              server.Dispose();
          }
  </code></pre>
  
  <p>Now, the problem is that <code>task.Wait()</code> block and make the android App to be non responsive. </p>
  
  <p>Now, I try to put the task into the form app:</p>
  
  <pre><code>type App() =
      inherit Application()
  
      let mutable task:System.Threading.Tasks.Task = null
  
      do
          let t, form = mainWebForm()
          task &lt;- t
          base.MainPage &lt;- form
  
          async {
            task.Start()
          } |&gt; ignore
  </code></pre>
  
  <p>But it not work on Android. However, in iOS it work fine (ie: the web server start listening)</p>