I tried to create a TaskFactory
instance with TaskContinuationOptions.RunContinuationsAsynchronously
, so that I am sure that tasks created will have their continuations run asynchronously. However, this doesn’t seem to be possible as I get an ArgumentOutOfRangeException
.
TaskFactory tf = new TaskFactory(TaskCreationOptions.None,
TaskContinuationOptions.RunContinuationsAsynchronously);
//ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'continuationOptions')
Now I think what I wanted to achieve is done by using TaskCreationOptions.RunContinuationsAsynchronously
and not TaskContinuationOptions.RunContinuationsAsynchronously
. This aside. I couldn’t find list of invalid options or why they are invalid in the docs.
So, why is TaskContinuationOptions.RunContinuationsAsynchronously
an invalid option for TaskFactory
?