2

下面的代码在.net 4.0编译时抛出异常,而在.net 2.0编译时,没关系,有人遇到我吗?请帮忙(我没有在回调函数中使用DateTime)。</p>

public void ProcessPriceUpdate()
{
    Interlocked.Increment(ref this.counts);

    lock (contractLock)
    {
        ThreadPool.QueueUserWorkItem(priceCallback, null);
    }
}


>System.ArgumentOutOfRangeException was unhandled
>Message=Value to add was out of range.
>Parameter name: value
>Source=mscorlib
>ParamName=value
>StackTrace:
>at System.DateTime.Add(Double value, Int32 scale)
>at System.Threading.PlatformHelper.get_ProcessorCount()
>at System.Threading.SpinWait.SpinOnce()
>at System.Threading.ThreadPoolWorkQueue.QueueSegment.TryDequeue(IThreadPoolWorkItem& node)
>at System.Threading.ThreadPoolWorkQueue.Dequeue(ThreadPoolWorkQueueThreadLocals tl, IThreadPoolWorkItem& callback, Boolean& missedSteal)
>at System.Threading.ThreadPoolWorkQueue.Dispatch()
>at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
>InnerException:
4

0 回答 0