title: SemaphoreSlim problems with asyc tasks
body: <p>I've been attempting to use SemaphoreSlim to limit the amount of concurrent tasks I have running at any one time but it seems to have no effect, likely down to my implementation which is why I'm here. My SemaphoreSlim code is like so:</p>
  <p>First it's called by</p>
  <pre><code>await Task.Run(() =&gt; mc.StartAsync());
  </code></pre>
  <p>Calling this method</p>
  <pre><code>public async Task StartAsync()
  {
      using (SemaphoreSlim concurrencySemaphore = new SemaphoreSlim(5))
      {
          foreach (var task in ThreadHandler.ThreadList)
          {
              await concurrencySemaphore.WaitAsync();
              try
              {
                  await Task.Run(() =&gt; task.Operation.Start());
              }
              finally
              {
                  concurrencySemaphore.Release();
              }
          }
      }
  }
  </code></pre>
  <p>This in turn is starting a task from a list which looks like this, this is in a custom model with the task stored and created previously</p>
  <pre><code>public Task Operation { get; set; }
  </code></pre>
  <pre><code>var t = new Task(async () =&gt;
  {
      await Task.Run(() =&gt; Method(input, sps));
  });
  </code></pre>
  <p>Remembering my code doesn't work as I'd expect, is this the correct way to start something like this? I don't expect 3 tasks launching from a single point is a good idea. The main reason It's like this is because I'm executing an Action&lt;&gt; and couldn't figure out a way to await it alone. Do these tasks count towards the SemaphoreSlim limit?</p>
  <p>After various tests I can confirm that my SemaphoreSlim code is just continiously executing the tasks, I added a large task delay into the list of tasks to see if I could stop it from executing which worked but new tasks were still launched... what am I missing?</p>
  <p>My goal is to have a limit on the number of tasks concurrenctly running, if that wasn't clear. Thank you for any assistance!</p>
  <p>EDIT: I think I've realised I'm only awaiting the starting of the task, not the completion.</p>