Quantcast
Viewing all articles
Browse latest Browse all 2206

New Post: Set ExecutionTimeLimit to TimeSpan.Zero doesn't work

When the TaskCompatibility.V1 is set (and I would recommend against it as the library will auto downgrade for XP) then you are working with the 15 year old task library and the ITask.SetMaxRunTime method which has proven a bit inconsistent in Vista and later. One of the bugs I've tried to work around may be causing your trouble. Here's the code from the workaround (in Task.cs) so you can see what's happening:
// Due to an issue introduced in Vista, and propagated to Windows 7, setting the// MaxRunTime to INFINITE results in the task only running for 72 hours. For// these operating systems, setting the RunTime to "INFINITE - 1" gets the// desired behavior of allowing an "infinite" run of the task.uint ms = value == TimeSpan.Zero ? InfiniteRunTimeV1 : Convert.ToUInt32(value.TotalMilliseconds);
v1Task.SetMaxRunTime(ms);
if (value == TimeSpan.Zero && v1Task.GetMaxRunTime() != InfiniteRunTimeV1)
   v1Task.SetMaxRunTime(InfiniteRunTimeV1 - 1);
I would strongly recommend not setting the V1 flag and letting the library choose the best version of the native implementation to do the work.

Viewing all articles
Browse latest Browse all 2206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>