<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Caught red-handed!</title><link>http://blogs.msdn.com/b/jmstall/archive/2006/04/05/outlook-bad-threading.aspx</link><description>I've been suspicious that a certain application that has been doing network access on their UI thread. (This is a horrible practice and anybody should be embarrassed doing it). I tried to bring up some properties that I knew resulted in a ping to a server</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Questions you should ask before using a callback / delegate</title><link>http://blogs.msdn.com/b/jmstall/archive/2006/04/05/outlook-bad-threading.aspx#824495</link><pubDate>Sat, 14 Oct 2006 10:06:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:824495</guid><dc:creator>Mike Stall's .NET Debugging Blog</dc:creator><description>&lt;p&gt;I just got burned by using callbacks in a multi-threaded app. I've rewritten the part to avoid callbacks,&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=824495" width="1" height="1"&gt;</description></item><item><title>re: Caught red-handed!</title><link>http://blogs.msdn.com/b/jmstall/archive/2006/04/05/outlook-bad-threading.aspx#572553</link><pubDate>Mon, 10 Apr 2006 18:46:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:572553</guid><dc:creator>Mike Stall - MSFT</dc:creator><description>Jim B - we totally agree that *background worker threads* (that aren't blocking the UI) are the right way to go.&lt;br&gt;&lt;br&gt;The problem here is using the *UI thread*. Thus the entire UI blocks while the UI thread is off pinging a server. &lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=572553" width="1" height="1"&gt;</description></item><item><title>re: Caught red-handed!</title><link>http://blogs.msdn.com/b/jmstall/archive/2006/04/05/outlook-bad-threading.aspx#572532</link><pubDate>Mon, 10 Apr 2006 18:21:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:572532</guid><dc:creator>Jim Brechtel</dc:creator><description>Most web applications, especially browsers (any browser, not just IE) will use multiple simultaneous background threads to connect to a server and download content. &amp;nbsp;There is absolutely nothing wrong with this. &amp;nbsp;In fact, if they did not use threads, your web application would operate much slower and you would see both text and graphic fields slowly populate one at a time.&lt;br&gt;&lt;br&gt;Unless the application is spyware or doing something malicious, why would using a background thread be an issue? &amp;nbsp;It's a matter of choice. &amp;nbsp;Either make the web application multi-threaded or else use a single thread and wait longer for it to get its work done.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=572532" width="1" height="1"&gt;</description></item><item><title>Testing network failures</title><link>http://blogs.msdn.com/b/jmstall/archive/2006/04/05/outlook-bad-threading.aspx#569867</link><pubDate>Thu, 06 Apr 2006 16:47:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:569867</guid><dc:creator>Jeff Stong</dc:creator><description>&lt;br&gt;&lt;br&gt;Mike&lt;br&gt;Stall points out why doing network access on a UI thread is a horrible&lt;br&gt;practice.&amp;amp;amp;nbsp; He...&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=569867" width="1" height="1"&gt;</description></item><item><title>re: Caught red-handed!</title><link>http://blogs.msdn.com/b/jmstall/archive/2006/04/05/outlook-bad-threading.aspx#569854</link><pubDate>Thu, 06 Apr 2006 16:33:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:569854</guid><dc:creator>Peter Ritchie</dc:creator><description>Technically, all applications I've ever seen do network communications on the UI thread--when they access a file over the network.&lt;br&gt;&lt;br&gt;Maybe a nice tidy reference implementation? &amp;nbsp;As you say in your previous post, anything that could take any amount of time should be done in a background thread. &amp;nbsp;It's a bit more detailed then that though; you're not suggesting the application become multi-threaded, just potentially-long-running tasks be done in another thread. &amp;nbsp;So, the application has to either be smart about synchronization if going the full MT route; or smart about turning off UI features (and providing feedback/progress) while it waits for the background thread to complete so synchronization is not an issue while the UI is responsive.&lt;br&gt;&lt;br&gt;I would hazard to say that most people reading this blog already know how to do what you're suggesting; but, some guidance (reference implementation(s)) for those who don't (or are to lazy) goes a long way.&lt;br&gt;&lt;br&gt;It doesn't help much when 99.99% of the samples on MSDN dealing with this topic do it the wrong way. &amp;nbsp;Usually samples that could block a UI are done in a console app to avoid the complexity of &amp;quot;doing it right&amp;quot;. &amp;nbsp;But, MSDN is the cookie-cutter code that most apps inherit from.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=569854" width="1" height="1"&gt;</description></item><item><title>re: Caught red-handed!</title><link>http://blogs.msdn.com/b/jmstall/archive/2006/04/05/outlook-bad-threading.aspx#569661</link><pubDate>Thu, 06 Apr 2006 09:39:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:569661</guid><dc:creator>IDisposable</dc:creator><description>The absolute WORST culprit for this is Explorer handling the pop-up window for viewing/selecting available Wireless Networks. &amp;nbsp;How stupid is that?&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=569661" width="1" height="1"&gt;</description></item><item><title>re: Caught red-handed!</title><link>http://blogs.msdn.com/b/jmstall/archive/2006/04/05/outlook-bad-threading.aspx#569638</link><pubDate>Thu, 06 Apr 2006 08:43:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:569638</guid><dc:creator>chris-at</dc:creator><description>I hope the Explorer (Windows?) team reads this.&lt;br&gt;&lt;br&gt;I've been waiting since Windows 95 for them to fix that.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=569638" width="1" height="1"&gt;</description></item><item><title>re: Caught red-handed!</title><link>http://blogs.msdn.com/b/jmstall/archive/2006/04/05/outlook-bad-threading.aspx#569623</link><pubDate>Thu, 06 Apr 2006 08:08:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:569623</guid><dc:creator>Dean Harding</dc:creator><description>Outlook is horrible for doing network access in the UI thread. It's not so bad when your just connecting with a POP3 account, but when you're connected to Exchange, it can sometimes be an aweful experience.&lt;br&gt;&lt;br&gt;In Outlook 2003, they added that little notifcation icon thing (being able to minimize Outlook to the notification tray is an awesome feature). When the UI thread of Outlook becomes unresponsive, the little notification icon pops up a balloon which says something like &amp;quot;please wait, there may be issues with your Exchange server which prevents Outlook from displaying it's UI&amp;quot;. What's wrong with that picture, I wonder?&lt;br&gt;&lt;br&gt;Explorer is another one for doing the same thing. It's horrible when a network drive goes down and Explorer just sits there being unresponsive for up to a minute until it times out.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=569623" width="1" height="1"&gt;</description></item></channel></rss>