title: Problems when trying to use async/await
body: <p>I'm following this <a href="https://stackoverflow.com/questions/33784841/how-to-implement-command-pattern-with-async-await">thread</a> to make some of my commands Async while others sync but I'm having some trouble.</p>
  <p>This is what I have so far.</p>
  <p>An interface:</p>
  <pre><code>public interface ICommand
  {
      public Task ExecuteAsync();
  }
  </code></pre>
  <p>Which I implement in a Wait Command which should be synchronous.</p>
  <pre><code>public class WaitCommand : ICommand
  {
      public Task ExecuteAsync()
      {
          Console.WriteLine(&quot;Sleeping...&quot;);
          Thread.Sleep(5000);
          Console.WriteLine(&quot;Waking up...&quot;);
          return Task.CompletedTask;
      }
  }
  </code></pre>
  <p>And another command that does work and should be assynchronous.</p>
  <pre><code>public class ConcreteCommand : ICommand
  {
      public async Task ExecuteAsync()
      {
          await Task.Run(() =&gt;
          {
              Console.WriteLine(&quot;Starting...&quot;);
              Thread.Sleep(1000);
              Console.WriteLine(&quot;Ending...&quot;);
          });
      }
  }
  </code></pre>
  <p>Then I have some sort of method to read a string and convert it to a command:</p>
  <pre><code>public async Task ExecuteAsync(string commandName)
      {
          ... get command
  
          await command.ExecuteAsync();
      }
  </code></pre>
  <p>And finally I have a loop</p>
  <pre><code>List&lt;string&gt; commands = new List&lt;string&gt;
  {
      &quot;concreteCommand&quot;,
      &quot;wait&quot;,
      &quot;concreteCommand&quot;
  };
  
  foreach (String command in commands)
  {
      await commandDispatcher.ExecuteAsync(command);
  }
  </code></pre>
  <p>This is what it prints.</p>
  <pre><code>Starting...
  Ending...
  Sleeping...
  Waking up...
  Starting...
  Ending...
  </code></pre>
  <p>Which means it's not running asynchronously. What's wrong in my implementation?</p>