<?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 : Possible EntityManager Threading bug?</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Possible EntityManager Threading bug?</description>
  <pubDate>Sun, 12 Apr 2026 14:40:33 -700</pubDate>
  <lastBuildDate>Wed, 03 Nov 2010 08:45:00 -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=2281</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>Possible EntityManager Threading bug? : You shouldn&amp;#039;t see a problem...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2281&amp;PID=9012#9012</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> 2281<br /><strong>Posted:</strong> 03-Nov-2010 at 8:45am<br /><br />You shouldn't see a problem with the above in a Silverlight application (or even WPF or WinForms if you want to do async there), but in free threading environments which don't synchronize a callback to the same thread you will see the issue.&nbsp; These environments would include a console application, unit test environments, and ASP.NET.&nbsp; If you do want to do async in these environments then setting the AuthorizedThreadId is required in order to avoid the exception.&nbsp; If you are running in a synchronized threading environment and seeing the error, it does mean that the EntityManager, which is not thread-safe, is being used on multiple threads.]]>
   </description>
   <pubDate>Wed, 03 Nov 2010 08:45:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2281&amp;PID=9012#9012</guid>
  </item> 
  <item>
   <title>Possible EntityManager Threading bug? :   HiI perform an async query...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2281&amp;PID=9010#9010</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=988" rel="nofollow">tersiusk</a><br /><strong>Subject:</strong> 2281<br /><strong>Posted:</strong> 03-Nov-2010 at 7:18am<br /><br />Hi<div><br></div><div>I perform an async query but the entity manager throws an exception because the thread id's don't match. By setting the&nbsp;<span ="apple-style-span"="" style="font-size: 11.6667px; ">AuthorizedThreadId to null the exceptions stop. I'm just wondering should&nbsp;</span><span ="apple-style-span"="" style="font-size: 11.6667px; ">AuthorizedThreadId be set to null in these cases or is something else going on?</span></div><div><br></div><div><span ="Apple-style-span" style="font-size: 11.6667px; -webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><table width="99%"><tr><td><pre class="BBcode"></span></div><div><div>EntityManager entityManager = new EntityManager();</div><div>entityManager.AuthorizedThreadId = null;</div><div><br></div><div>var userQuery = entityManager.GetQuery&lt;User&gt;().Where(u =&gt; u.Username.ToLower() == valuetoverify.ToString());</div><div><br></div><div>userQuery.ExecuteAsync((u) =&gt;</div><div>{</div><div>&nbsp;&nbsp; &nbsp;var results = u.Results;</div><div>});</div></div><div><span ="apple-style-span"="" style="font-size: 11.6667px; -webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "></pre></td></tr></table></span></div><span style="font-size:10px"><br /><br />Edited by tersiusk - 03-Nov-2010 at 7:19am</span>]]>
   </description>
   <pubDate>Wed, 03 Nov 2010 07:18:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2281&amp;PID=9010#9010</guid>
  </item> 
 </channel>
</rss>