I was wondering, why the methods Task.WaitForTask sometimes returns immediatly and sometimes wait until the task finishes independent of the given timeout. I looked at the source code with the help of the reflector and found amongst others the following lines of code:
longendTime = (timeout > 0L) ? (DateTime.Now.Millisecond + timeout) : 0L;
if((DateTime.Now.Millisecond > endTime) && (endTime > 0L))
As you can see, the error lies in the usage of the property Millisecond (which returns only the time component of the current timestamp from 0 to 999). As workaround I use the following method:
↧
Error in SDK 5.5 in method Task.WaitForTask
↧