WaitAll with Task not working
<p>I Created several Task in the way below. But it seems <code>WaitAll</code> is not working. It is sending response without wait. Anything goes wrong here?</p>

<pre><code>private void GetItemsPrice(IEnumerable&lt;Item&gt; items, int customerNumber)
    {
        try
        {
            var tasks = new List&lt;Task&gt;();

            for (var i = 0; i &lt; items.Count(); i += 50)
            {
                var newTask = DoGetItemsPrice(items.Skip(i).Take(50), customerNumber);    
                tasks.Add(newTask);
            }

            Task.WaitAll(tasks.ToArray());
        }
        catch (Exception ex)
        {
            ErrorLog.WriteLog(GetType().Name, "GetItemsPrice", string.Format("customerNumber={0}", customerNumber), ex.Message);
        }
    }

private static Task DoGetItemsPrice(IEnumerable&lt;Item&gt; items, int customerNumber)
    {
        return Task.Factory.StartNew(() =&gt;
        {
            var sxApiObj = new SxApiService();
            var request = new OEPricingMultipleRequest();

            request.customerNumber = customerNumber;
            request.arrayProduct =
                items.Select(
                    itemCode =&gt;
                    new OEPricingMultipleinputProduct
                    {
                        productCode = itemCode.ItmNum,
                        quantity = itemCode.Quantity,
                        warehouse = ConfigurationVariables.DefaultWareHouse
                    }).ToArray();
            var response = sxApiObj.OEPricingMultiple(ConfigurationVariables.SfAppServer,
                                                  ConfigurationVariables.SfUserId,
                                                  ConfigurationVariables.SfPassword,
                                                  request);

            if (response.arrayPrice != null)
            {
                foreach (var priceData in response.arrayPrice)
                {
                    var productCode = priceData.productCode;
                    var item = items.FirstOrDefault(itm =&gt; itm.ItmNum == productCode);

                    if (item == null) continue;
                    item.ItmListPrice1 = priceData.price.ToString("c", ConfigurationVariables.UsCulture);
                    item.ItmListPrice2 = priceData.discountAmount.ToString("c", ConfigurationVariables.UsCulture);
                    item.ItmListPrice3 = priceData.extendedAmount.ToString("c", ConfigurationVariables.UsCulture);

                    item.Quantity = priceData.netAvailable;
                }
            }
        });
    }
</code></pre>
