<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Serial Coroutines and ManagedThreadId</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Serial Coroutines and ManagedThreadId</description>
  <pubDate>Sat, 11 Apr 2026 20:41:37 -700</pubDate>
  <lastBuildDate>Mon, 01 Nov 2010 20:27:41 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=2277</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Serial Coroutines and ManagedThreadId : Thanks, I was testing this in...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2277&amp;PID=9000#9000</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=613" rel="nofollow">stephenmcd1</a><br /><strong>Subject:</strong> 2277<br /><strong>Posted:</strong> 01-Nov-2010 at 8:27pm<br /><br />Thanks, I was testing this in two place. &nbsp;One was a unit test which we expect to fail. &nbsp;The other was in a Silverlight app but I found that it was something else that was messing with my entity manager so mystery solved. &nbsp;Thanks for the help.]]>
   </description>
   <pubDate>Mon, 01 Nov 2010 20:27:41 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2277&amp;PID=9000#9000</guid>
  </item> 
  <item>
   <title>Serial Coroutines and ManagedThreadId : It should be possible with serial...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2277&amp;PID=8989#8989</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 2277<br /><strong>Posted:</strong> 29-Oct-2010 at 3:52pm<br /><br />It should be possible with serial execution, and does work in our tests. <DIV>&nbsp;</DIV><DIV>I can think of two reasons why you might get this error:</DIV><UL><LI>The Uow.EntityManager was constructed on another thread, or</LI><LI>You're running in a test environment (or a console application) which does free threading and doesn't&nbsp;synchronize threads to the context.&nbsp; </LI></UL>]]>
   </description>
   <pubDate>Fri, 29 Oct 2010 15:52:51 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2277&amp;PID=8989#8989</guid>
  </item> 
  <item>
   <title>Serial Coroutines and ManagedThreadId : I&amp;#039;ve run into problems when...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2277&amp;PID=8986#8986</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=613" rel="nofollow">stephenmcd1</a><br /><strong>Subject:</strong> 2277<br /><strong>Posted:</strong> 29-Oct-2010 at 12:55pm<br /><br />I've run into problems when using Serial Coroutines with respect to the ManagedThreadId property on the EntityManager. &nbsp;The exception specifically says that I should "Consider calling the EntityManager’s asynchronous methods; they work safely on background threads managed by DevForce.&nbsp;" &nbsp;I thought I was using the asynchronous methods so I was expecting it to work. &nbsp;An example of the code is as follows:<div><br></div><div><table width="99%"><tr><td><pre class="BBcode">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;public void TestCoroutine(AsyncEventCompletedCallback&lt;GenericAsyncEventArgs&lt;int&gt;&gt; callback)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//Get the entity manager from somewhere</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var myEntityManager = Uow.EntityManager;</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Coroutine.Start(</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;() =&gt; BuildBasicCoroutine(myEntityManager),</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;op =&gt;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//Always fails</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;});</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;private static IEnumerable&lt;INotifyCompleted&gt; BuildBasicCoroutine(DataModelEntityManager em)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;yield return em.Users.ExecuteAsync();</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;yield return em.Contracts.ExecuteAsync();</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</pre></td></tr></table></div><div><br></div><div>If I switch it to use Coroutine.StartParallel it will succeed just fine but in many cases I actually need serial behavior becaues one query depends on a previous query. &nbsp;</div><div><br></div><div>It seems like this should be possible and maybe I'm just doing something basic wrong. &nbsp;Any help would be appreciated.</div>]]>
   </description>
   <pubDate>Fri, 29 Oct 2010 12:55:32 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2277&amp;PID=8986#8986</guid>
  </item> 
 </channel>
</rss>