title: SignalR hub method not reporting all calls to IProgress.Report
body: <p>I have a situation here where my javascript application is calling back into the server using web socket with the signalR proxy.</p>
  
  <p>I have a long running method for which I report progress 10 times.</p>
  
  <p>However I noticed that the client progress callback is not always called 10 times even though the server method definitely calls it 10 times.</p>
  
  <p>Here is the server method pseudo code simplified for clarity:</p>
  
  <pre><code>public async Task LongRunning(IProgress&lt;Something&gt; progress)
      {
          var things = await Get10ThingsFromDb();
          foreach (var thing in things)
          {
              var something = ComputeSomething(thing);
              progress.Report(something);
          }
      }
  </code></pre>
  
  <p>Notice that right after that last call to progress.Report, the method finishes immediately after.</p>
  
  <p>Most of the time it works fine, but maybe once every 5 times I get less than 10 report calls, sometimes even just 1.</p>
  
  <p>I have inspected the network tab in Chrome, and it seems that the problem is that the server is sometimes sending the method completion result BEFORE it has sent all the reports.</p>
  
  <p>So in a normal case the server sends the following frames</p>
  
  <p>-Report 10 times</p>
  
  <p>-Completion 1 time</p>
  
  <p>But in a failed case the server sends the following frames.</p>
  
  <p>-Report 7 times</p>
  
  <p>-Completion 1 time</p>
  
  <p>-Report 3 times</p>
  
  <p>My guess is that the js client discards any progress report that happens after the completion.</p>
  
  <p>I ended up adding <code>await Task.Delay(100)</code>
  at the end of the server method to avoid the race condition. This is not ideal...</p>
  
  <p>Is this a bug or am I missing something?</p>
  
  <p>Thanks</p>