<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9 Forums - Tech Off - Nested Task.Factory.StartNew() creates the task on the UI thread</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Forums/rss"></atom:link>
	<image>
		<url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
		<title>Channel 9 Forums - Tech Off - Nested Task.Factory.StartNew() creates the task on the UI thread</title>
		<link>http://channel9.msdn.com/Forums</link>
	</image>
	<description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
	<link>http://channel9.msdn.com/Forums</link>
	<language>en</language>
	<pubDate>Wed, 22 May 2013 06:55:40 GMT</pubDate>
	<lastBuildDate>Wed, 22 May 2013 06:55:40 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<c9:totalResults>6</c9:totalResults>
	<c9:pageCount>-6</c9:pageCount>
	<c9:pageSize>-1</c9:pageSize>
	<item>
		<title>Tech Off - Nested Task.Factory.StartNew() creates the task on the UI thread</title>
		<description><![CDATA[<p>I have some code that uses Task.Factory.StartNew() to start a background task when the user clicks a button. Upon completion, the background task then calls Task.Factory.StartNew() but specifies the UI thread context in order to update the UI with the results.</p><p>This work fine. However now I have a UI option that will allow the task to run repeatedly until the user cancels it. So now in the second Task.Factory.StartNew() that runs the task on the UI thread, I just call the first function that starts the background task again. However what I'm finding is that the second time around, the first Task.Factory.StartNew() runs the task on the UI thread even though I did not pass in a thread context to it. I'm not sure it matters, but I'm passing in TaskCreationOptions.LongRunning as well for both calls.</p><p>To put it another way...&nbsp;In both cases the first Task.Factory.StartNew() was called from the UI thread. The 1st time, it runs the task on a background thread. The second time, on the UI thread. Exact same code and&nbsp;parameters.</p><p>Any ideas why this would be happening?</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/84e69ea2ed2e4d96bfcfa0ed013b8229#84e69ea2ed2e4d96bfcfa0ed013b8229</link>
		<pubDate>Wed, 17 Oct 2012 19:08:43 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/84e69ea2ed2e4d96bfcfa0ed013b8229#84e69ea2ed2e4d96bfcfa0ed013b8229</guid>
		<dc:creator>BitFlipper</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/BitFlipper/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Nested Task.Factory.StartNew() creates the task on the UI thread</title>
		<description><![CDATA[<p>Looks like I'm running into <a href="http://blogs.msdn.com/b/pfxteam/archive/2012/09/22/new-taskcreationoptions-and-taskcontinuationoptions-in-net-4-5.aspx">this problem</a>. However I'm not using the ContinueWith call, so I'm not sure how to fix my issue. I'm essentially making a nested&nbsp;call to Task.Factory.StartNew().</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/a043105b01254bb59c1fa0ed013eca29#a043105b01254bb59c1fa0ed013eca29</link>
		<pubDate>Wed, 17 Oct 2012 19:20:40 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/a043105b01254bb59c1fa0ed013eca29#a043105b01254bb59c1fa0ed013eca29</guid>
		<dc:creator>BitFlipper</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/BitFlipper/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Nested Task.Factory.StartNew() creates the task on the UI thread</title>
		<description><![CDATA[<p>OK I solved the problem by passing in TaskScheduler.Default&nbsp;into the 2nd [fixed it] Task.Factory.StartNew() call.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/aa5570dd4c7a456a9202a0ed0142e1b4#aa5570dd4c7a456a9202a0ed0142e1b4</link>
		<pubDate>Wed, 17 Oct 2012 19:35:34 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/aa5570dd4c7a456a9202a0ed0142e1b4#aa5570dd4c7a456a9202a0ed0142e1b4</guid>
		<dc:creator>BitFlipper</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/BitFlipper/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Nested Task.Factory.StartNew() creates the task on the UI thread</title>
		<description><![CDATA[<p>[TaskScheduler.Default] puts the first thread at a known location so that it can be found for the next thread evoked? How does it work?</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/90c4d8f0adb544759b4ca0ed01440a6d#90c4d8f0adb544759b4ca0ed01440a6d</link>
		<pubDate>Wed, 17 Oct 2012 19:39:47 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/90c4d8f0adb544759b4ca0ed01440a6d#90c4d8f0adb544759b4ca0ed01440a6d</guid>
		<dc:creator>JohnAskew</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/JohnAskew/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Nested Task.Factory.StartNew() creates the task on the UI thread</title>
		<description><![CDATA[<p></p><blockquote><div class="quoteText"><p></p><p><a class="permalink" title="Post Permalink" href="/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/90c4d8f0adb544759b4ca0ed01440a6d">57 minutes&nbsp;ago</a>, <a href="/Niners/JohnAskew">JohnAskew</a> wrote</p><p>[TaskScheduler.Default] puts the first thread at a known location so that it can be found for the next thread evoked? How does it work?</p><p></p></div></blockquote><p></p><p>I have no idea. But it fixed my issue.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/a779b540bc9046d0ababa0ed0153f60d#a779b540bc9046d0ababa0ed0153f60d</link>
		<pubDate>Wed, 17 Oct 2012 20:37:45 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/a779b540bc9046d0ababa0ed0153f60d#a779b540bc9046d0ababa0ed0153f60d</guid>
		<dc:creator>BitFlipper</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/BitFlipper/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Nested Task.Factory.StartNew() creates the task on the UI thread</title>
		<description><![CDATA[<p></p><blockquote><div class="quoteText"><p></p><p><a class="permalink" title="Post Permalink" href="/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/a779b540bc9046d0ababa0ed0153f60d">15 minutes&nbsp;ago</a>, <a href="/Niners/BitFlipper">BitFlipper</a> wrote</p><p>*snip*</p><p>I have no idea. But it fixed my issue.</p><p></p></div></blockquote><p></p><p>Ah you are correct. Sorry that was a typo. I'm passing TaskScheduler.Default into the <strong>2nd</strong> call.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/95d8a523adfc4f738d5ba0ed01584b0c#95d8a523adfc4f738d5ba0ed01584b0c</link>
		<pubDate>Wed, 17 Oct 2012 20:53:31 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/Nested-TaskFactoryStartNew-creates-the-task-on-the-UI-thread/95d8a523adfc4f738d5ba0ed01584b0c#95d8a523adfc4f738d5ba0ed01584b0c</guid>
		<dc:creator>BitFlipper</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/BitFlipper/Discussions/RSS</wfw:commentRss>
	</item>
</channel>
</rss>