{"id":4154,"date":"2014-03-30T08:29:34","date_gmt":"2014-03-30T08:29:34","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/task-factory-startnew-doesnt-always-start-the-task-collection-of-common-programming-errors\/"},"modified":"2014-03-30T08:29:34","modified_gmt":"2014-03-30T08:29:34","slug":"task-factory-startnew-doesnt-always-start-the-task-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/task-factory-startnew-doesnt-always-start-the-task-collection-of-common-programming-errors\/","title":{"rendered":"Task.Factory.StartNew doesn&#39;t always start the task-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m seeing this strange behavior where the runtime sometimes doesn&#8217;t start a task <code>Task.Factory.StartNew<\/code> when called. I am specifically going over it in the debugger, but for some reason the task does not run. This happens sporadically, sometimes the task starts and sometimes it doesn&#8217;t.<\/p>\n<pre><code>Task.Factory.StartNew(() =&gt;\n                        {\n                            Extract(fileName);\n                        }, TaskCreationOptions.LongRunning);  \n\n        private static void Extract(String fileName)\n        {\n   Trace.WriteLine(\"Extract------------------     ---------------      ---\");\n        }\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m seeing this strange behavior where the runtime sometimes doesn&#8217;t start a task Task.Factory.StartNew when called. I am specifically going over it in the debugger, but for some reason the task does not run. This happens sporadically, sometimes the task starts and sometimes it doesn&#8217;t. Task.Factory.StartNew(() =&gt; { Extract(fileName); }, TaskCreationOptions.LongRunning); private static void Extract(String [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4154","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4154"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4154\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}