以下のコードは、.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: