<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/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>Fabrice&amp;#39;s weblog</title><link>http://weblogs.asp.net/fmarguerie/default.aspx</link><description>Tools and Source</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Memory leaks with Infragistics NetAdvantage Windows Forms edition</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/11/20/memory-leaks-infragistics-netadvantage-windows-forms.aspx</link><pubDate>Fri, 20 Nov 2009 11:07:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7213904</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7213904</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/11/20/memory-leaks-infragistics-netadvantage-windows-forms.aspx#comments</comments><description>&lt;p&gt;When I finalized &lt;a href="http://weblogs.asp.net/fmarguerie/archive/2009/11/03/article-detect-avoid-memory-leaks.aspx" tooltip="linkalert-tip" mce_href="http://weblogs.asp.net/fmarguerie/archive/2009/11/03/article-detect-avoid-memory-leaks.aspx"&gt;my article about memory leaks&lt;/a&gt;, I removed a part about Infragistics NetAdvantage. Here it is. It may be useful to some of you. Warning: It's based on NetAdvantage 7.3, and may or may not apply to recent versions.&lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Let's take an example. In project X, visual controls from the Infragistics NetAdvantage suite are used to build the GUI. One of these controls is the UltraToolbar. As told by its name, this control is used to display toolbars. The way a UltraToolbar is used is via a UltraToolbarsManager component. This works fine, except that even though the UltraToolbar class implements IDisposable, the UltraToolbarsManager class never calls the Dispose method on the UltraToolbars it manages. This is a bug. Fortunately, a workaround is easy to find: just call Dispose by yourself on each UltraToolbar. Unfortunately, this is not enough because UltraToolbar itself is buggy: it does not dispose the controls (buttons, labels, etc.) it contains. Again, the solution is to dispose each control the toolbar contain, but that's not so easy this time because each sub-control is different. Infragistics has the same problem with another set of objects: the custom editors you can create for cells in grids are not disposed automatically either.&lt;br&gt; Anyway, these are just specific examples. My point is that any libraries and components you use may cause leaks in your applications.&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Later in the article:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Let's take an interesting example that shows another particularity of Infragistics NetAdvantage. The scenario is simple: just dynamically add a button to a form. The only special thing about this button is that it will be an UltraButton from Infragistics NetAdvantage.
  &lt;br&gt;
  Here is how the button is added to the form (UltraButtonForm.cs):&lt;/p&gt;&lt;p style="font-family: Courier New; size: 10pt; font-weight: bold; color: Navy;"&gt;
  _ultraButton = new UltraButton();&lt;br&gt;
  _ultraButton.Text = "UltraButton";&lt;br&gt;
  _ultraButton.Location = new Point(10, 100);&lt;br&gt;
  Controls.Add(_ultraButton);
&lt;/p&gt;&lt;p&gt;Nothing fancy here. We just create a new instance of UltraButton and add it to the list of controls of the form so that it gets displayed. This works fine. Even when the form is closed/disposed, everything gets released.&lt;/p&gt;&lt;p&gt;Now, let's do one more little thing: remove the button before closing the form.&lt;/p&gt;&lt;p style="font-family: Courier New; size: 10pt; font-weight: bold; color: Navy;"&gt;Controls.Remove(_ultraButton);&lt;/p&gt;&lt;p&gt;Guess what: now there is a problem! And potentially a big one.&lt;br&gt;
  The problem is that the UltraButton is not released from memory this time. And it's not alone, as I'll show soon.&lt;/p&gt;&lt;div&gt;&lt;img src="http://weblogs.asp.net/controlpanel/blogs/Pictures/Infra.png" mce_src="Pictures/Infra.png"&gt;&lt;/div&gt;&lt;p&gt;As you can see, the button is kept alive by an event from the Infragistics.Win.Office2007ColorTable class named ColorSchemeChanged. This happens because this is a static event and UltraButton uses its Dispose method to unsubscribe from this event.&lt;/p&gt;&lt;p&gt;Without the call to Controls.Remove, everything was fine because all the controls contained in the Controls property of a Windows Forms Control are automatically disposed. When a control is removed from the Controls collection, it won't be disposed unless you do it explicitely yourself.&lt;/p&gt;&lt;p&gt;Here, the leak is due to a static event named ColorSchemeChanged, or one of its friends. The only way to ensure that such references get released is to make sure that Dispose is invoked on ALL the Infragistics controls. This is achieved via invoking Dispose on all the other controls.&lt;/p&gt;&lt;p&gt;If you use Infragistics NetAdvantage you may already have seen ColorSchemeChanged, Office2007ColorTable, and their friend, and maybe thought that there was a bug in them that caused leaks. As you have seen, this is not a bug per se, but it can be a source of memory leaks if you don't pay careful attention to ensure that all controls get disposed.&lt;/p&gt;&lt;p&gt;So, we've just seen again what I exposed above with static events. What I want to stress here is that it's easy to introduce a leak with just a line of code. Would you have thought about memory leaks when adding the call to Controls.Remove?&lt;br&gt;
  An UltraButton may not be a big object, but if you have several of them and if you do the same operation multiple times, you'll start to see a bigger leak. In addition, this doesn't happen only with UltraButton, but also with most of the other Infragistics controls, and potentially with other objects that subscribe to static events and depend on Dispose for unsubscribing. The only way to ensure that all objects get fully released is to make sure that Dispose is invoked on all controls.&lt;/p&gt;&lt;/blockquote&gt;
  

  

  


  

  
  


  
  

  

  

  




&lt;p&gt;&lt;a href="http://madgeek.com/Articles/Leaks/InfragisticsSamples.zip" mce_href="http://madgeek.com/Articles/Leaks/InfragisticsSamples.zip"&gt;Sample source code&lt;/a&gt;&lt;br&gt;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7213904" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Source/default.aspx">Source</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tips/default.aspx">Tips</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category></item><item><title>MVVM frameworks galore</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/11/11/mvvm-frameworks-galore.aspx</link><pubDate>Wed, 11 Nov 2009 13:28:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7251448</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7251448</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/11/11/mvvm-frameworks-galore.aspx#comments</comments><description>
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Model_View_ViewModel" mce_href="http://en.wikipedia.org/wiki/Model_View_ViewModel"&gt;The MVVM pattern&lt;/a&gt; (Model-View-ViewModel, also known as M-V-VM, the PresentationModel pattern, or the ViewModel pattern) appeared &lt;a href="http://blogs.msdn.com/johngossman/archive/2005/10/08/478683.aspx"&gt;a long&lt;/a&gt; &lt;a href="http://martinfowler.com/eaaDev/PresentationModel.html"&gt;time ago&lt;/a&gt; now, but it took some time before it became more documented and well known. Over the last few months, MVVM boomed, especially with an explosion of dedicated frameworks. It's difficult to know what each framework proposes and which one to choose. Fortunately, Jeremy Alles has compiled &lt;a href="http://www.japf.fr/2009/10/a-quick-tour-of-existing-mvvm-frameworks/" tooltip="linkalert-tip" mce_href="http://www.japf.fr/2009/10/a-quick-tour-of-existing-mvvm-frameworks/"&gt;pointers to all the MVVM frameworks available today&lt;/a&gt;. He even lists the main features of each framework.&lt;br&gt;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7251448" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tools/default.aspx">Tools</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/UI/default.aspx">UI</category></item><item><title>The core WPF classes</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/11/11/the-core-wpf-classes.aspx</link><pubDate>Wed, 11 Nov 2009 13:18:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7251416</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7251416</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/11/11/the-core-wpf-classes.aspx#comments</comments><description>&lt;p&gt;Jeremy Alles proposes a nice &lt;a href="http://www.japf.fr/2009/10/wpf-internals-part-1-what-are-the-core-wpf-classes/" tooltip="linkalert-tip" mce_href="http://www.japf.fr/2009/10/wpf-internals-part-1-what-are-the-core-wpf-classes/"&gt;tour of the core WPF classes&lt;/a&gt;. It comes with a class diagram and quick descriptions.&lt;br&gt;I'll keep a link to it here for reference. It's the kind of document I'll refer to several times.&lt;/p&gt;&lt;p&gt;Covered classes include &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcherobject.aspx" tooltip="linkalert-tip" id="qm:t" title="DispatcherObject"&gt;DispatcherObject&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/fr-fr/library/system.windows.frameworktemplate.aspx" tooltip="linkalert-tip" id="rxya" title="FrameworkTemplate"&gt;FrameworkTemplate&lt;/a&gt;, &lt;a href="http://www.japf.fr/2009/10/wpf-internals-part-1-what-are-the-core-wpf-classes/index.php?page=stats" tooltip="linkalert-tip" id="n2rs" title="DependencyObject"&gt;DependencyObject&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.media.visual.aspx" tooltip="linkalert-tip" id="x0bz" title="Visual"&gt;Visual&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.markup.iaddchild.aspx" tooltip="linkalert-tip" id="tpqv" title="UIElement"&gt;UIElement&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.aspx" tooltip="linkalert-tip" id="zm48" title="FrameworkElement"&gt;FrameworkElement&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.control.aspx" tooltip="linkalert-tip" id="fc2v" title="Control"&gt;Control&lt;/a&gt;, and much more.  &lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7251416" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/UI/default.aspx">UI</category></item><item><title>New article: How to detect and avoid memory and resources leaks in .NET applications</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/11/03/article-detect-avoid-memory-leaks.aspx</link><pubDate>Mon, 02 Nov 2009 23:32:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7213885</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7213885</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/11/03/article-detect-avoid-memory-leaks.aspx#comments</comments><description>&lt;p&gt;My new article, which I've been preparing over the last few months, is now available. It's about &lt;b&gt;memory and resources leaks in .NET&lt;/b&gt;.&lt;br&gt;You'll find it &lt;a href="http://msdn.microsoft.com/en-us/library/ee658248.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ee658248.aspx"&gt;in English on MSDN&lt;/a&gt; and &lt;a href="http://dotnetguru.org/modules.php?file=article&amp;amp;sid=1283" mce_href="http://dotnetguru.org/modules.php?file=article&amp;amp;sid=1283"&gt;in French on DotNetGuru.org&lt;/a&gt;. It's also available in PDF &lt;a href="http://madgeek.com/Articles/Leaks/Leaks.en.pdf" mce_href="http://madgeek.com/Articles/Leaks/Leaks.en.pdf"&gt;in English&lt;/a&gt; and &lt;a href="http://madgeek.com/Articles/Leaks/Leaks.fr.pdf" mce_href="http://madgeek.com/Articles/Leaks/Leaks.fr.pdf"&gt;in French&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Here is the table of content:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt; Introduction&lt;/li&gt;&lt;li&gt;Leaks? Resources? What do you mean?&lt;/li&gt;&lt;li&gt;How to detect leaks and find the leaking resources&lt;/li&gt;&lt;li&gt;Common memory leak causes&lt;/li&gt;&lt;li&gt;Common memory leaks causes demonstrated&lt;/li&gt;&lt;li&gt;How to avoid leaks&lt;/li&gt;&lt;li&gt;Tools&lt;/li&gt;&lt;li&gt;Conclusion&lt;/li&gt;&lt;li&gt;Resources&lt;/li&gt;&lt;/ul&gt;&lt;i&gt;Despite what a lot of people believe, it's easy to introduce memory and resources leaks in .NET applications. The Garbage Collector, or GC for close friends, is not a magician who would completely relieve you from taking care of your memory and resources consumption.&lt;br&gt;I'll explain in this article why memory leaks exist in .NET and how to avoid them. Don't worry, I won't focus here on the inner workings of the garbage collector and other advanced characteristics of memory and resources management in .NET.&lt;br&gt;It's important to understand leaks and how to avoid them, especially since they are not the kind of things that is easy to detect automatically. Unit tests won't help here. And when your application crashes in production, you'll be in a rush looking for solutions. So, relax and take the time to learn more about this subject before it's too late.&lt;/i&gt;&lt;br&gt;
&lt;hr width="40%"&gt;
&lt;p&gt;Mon nouvel article, que j'ai préparé durant ces derniers mois, est maintenant disponible. Il parle des &lt;b&gt;fuites de mémoire et de ressources en .NET&lt;/b&gt;.&lt;br&gt;Vous le trouverez &lt;a href="http://dotnetguru.org/modules.php?file=article&amp;amp;sid=1283" mce_href="http://dotnetguru.org/modules.php?file=article&amp;amp;sid=1283"&gt;en français sur DotNetGuru.org&lt;/a&gt; et &lt;a href="http://msdn.microsoft.com/en-us/library/ee658248.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ee658248.aspx"&gt;en anglais sur MSDN&lt;/a&gt;. Il est également disponible en PDF &lt;a href="http://madgeek.com/Articles/Leaks/Leaks.fr.pdf" mce_href="http://madgeek.com/Articles/Leaks/Leaks.fr.pdf"&gt;en français&lt;/a&gt; et &lt;a href="http://madgeek.com/Articles/Leaks/Leaks.en.pdf" mce_href="http://madgeek.com/Articles/Leaks/Leaks.en.pdf"&gt;en anglais&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Voici la table des matières :&lt;/p&gt;
&lt;ul&gt;&lt;li&gt; Introduction&lt;/li&gt;&lt;li&gt;Fuites ? Ressources ? Qu'entendez-vous par là ?&lt;/li&gt;&lt;li&gt;Comment détecter des fuites et repérer les ressources qui fuient&lt;/li&gt;&lt;li&gt;Les causes habituelles de fuites de mémoire&lt;/li&gt;&lt;li&gt;Les causes habituelles de fuites en pratique&lt;/li&gt;&lt;li&gt;Comment éviter les fuites&lt;/li&gt;&lt;li&gt;Outils&lt;/li&gt;&lt;li&gt;Conclusion&lt;/li&gt;&lt;li&gt;Ressources&lt;/li&gt;&lt;/ul&gt;&lt;i&gt;En dépit de ce que beaucoup de personnes pensent, il est facile d'introduire des fuites de mémoire et de ressources dans les applications .NET. Le Garbage Collector, également appelé ramasse-miettes ou GC pour les intimes, n'est pas un magicien qui vous affranchirait totalement de vous soucier de la consommation de ressources et de mémoire.&lt;/i&gt;&lt;br&gt;&lt;i&gt;J'expliquerai dans cet article pourquoi les fuites de mémoire existent en .NET et comment les éviter. Ne vous en faites pas, je ne vais pas me focaliser ici sur le fonctionnement interne du garbage collector et autres caractéristiques avancées de la gestion de la mémoire et de ressources en .NET&lt;/i&gt;&lt;br&gt;&lt;i&gt;Il est important de comprendre les fuites et comment les éviter, particulièrement car elles n'entrent pas dans la catégorie des choses facilement détectables de manière automatisée. Les test unitaires ne vous aideront pas ici. Et quand votre application se plantera en production, vous serez à la recherche de solutions dans l'urgence. Alors, détendez-vous et prenez le temps dès maintenant d'en apprendre plus sur ce sujet avant qu'il ne soit trop tard.&lt;/i&gt;&lt;br&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7213885" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Source/default.aspx">Source</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tools/default.aspx">Tools</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tips/default.aspx">Tips</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category></item><item><title>fivesecondtest, quick usability testing</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/10/06/fivesecondtest-quick-usability-testing.aspx</link><pubDate>Tue, 06 Oct 2009 11:49:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7223989</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7223989</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/10/06/fivesecondtest-quick-usability-testing.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://fivesecondtest.com" tooltip="linkalert-tip" mce_href="http://fivesecondtest.com"&gt;fivesecondtest.com&lt;/a&gt;, "A simple online usability test that helps you identify the most prominent elements of your user interfaces."&lt;/p&gt;&lt;p&gt;Simple yet great idea.&lt;/p&gt;&lt;p&gt;Here is an example: &lt;a href="http://fivesecondtest.com/test/TfPBuUF4" tooltip="linkalert-tip" mce_href="http://fivesecondtest.com/test/TfPBuUF4"&gt;Help me improve a design I'm working on by doing a five second test&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7223989" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tools/default.aspx">Tools</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Sites/default.aspx">Sites</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/UI/default.aspx">UI</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/General+Software+Development/default.aspx">General Software Development</category></item><item><title>New LINQ tools category on SharpToolbox.com</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/10/03/new-linq-tools-category-on-sharptoolbox-com.aspx</link><pubDate>Sat, 03 Oct 2009 14:55:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7222358</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7222358</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/10/03/new-linq-tools-category-on-sharptoolbox-com.aspx#comments</comments><description>&lt;p&gt;I've just moved the LINQ tools referenced on SharpToolbox.com to a new &lt;a href="http://SharpToolbox.com/categories/linq" mce_href="http://SharpToolbox.com/categories/linq"&gt;dedicated LINQ category&lt;/a&gt;.&lt;br&gt;20 tools and providers are listed for the moment. I'll add more shortly.&lt;/p&gt;&lt;p&gt;See &lt;a href="http://www.thinqlinq.com/Post.aspx/PostId/22076" tooltip="linkalert-tip" mce_href="http://www.thinqlinq.com/Post.aspx/PostId/22076"&gt;Jim's blog&lt;/a&gt; for more resources.&lt;br&gt;&lt;/p&gt;
&lt;br&gt;&lt;i&gt;Cross-posted from &lt;a href="http://linqinaction.net/" tooltip="linkalert-tip"&gt;http://linqinaction.net&lt;/a&gt;&lt;/i&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7222358" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tools/default.aspx">Tools</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/_2800_Sharp_7C00_Java_2900_Toolbox/default.aspx">(Sharp|Java)Toolbox</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/LINQ/default.aspx">LINQ</category></item><item><title>XMLAuto version 2010</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/09/26/xmlauto-version-2010.aspx</link><pubDate>Sat, 26 Sep 2009 15:41:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7217121</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7217121</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/09/26/xmlauto-version-2010.aspx#comments</comments><description>&lt;p&gt;Ten years ago, I played with OLE Automation so we can write things such as the following, where &lt;i&gt;Document&lt;/i&gt; represents an XML document:&lt;/p&gt;&lt;p&gt;&lt;font color="#000066" face="courier new,courier"&gt;String name = Document.Bookstore.Book[1].Author.LastName;&lt;br&gt;Document.Bookstore.Book[1].Author.LastName = "NewName";&lt;br&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;The experiment  was named &lt;a href="http://weblogs.asp.net/fmarguerie/archive/2003/05/16/7137.aspx" tooltip="linkalert-tip" mce_href="http://weblogs.asp.net/fmarguerie/archive/2003/05/16/7137.aspx"&gt;XMLAuto&lt;/a&gt;.&lt;br&gt;I wanted to implement this again with C# 4's &lt;i&gt;dynamic&lt;/i&gt; keyword, but I won't have to do it. &lt;a href="http://mark.michaelis.net/Blog/DynamicallyTypedObjectsWithC40.aspx" tooltip="linkalert-tip" mce_href="http://mark.michaelis.net/Blog/DynamicallyTypedObjectsWithC40.aspx"&gt;Mark Michaelis and Michael Stokesbary already played with this&lt;/a&gt; (last year).&lt;br&gt;I find it's an interesting way to learn how to implement &lt;i&gt;IDynamicObject&lt;/i&gt;.&lt;/p&gt;&lt;p&gt;&lt;font color="#006600"&gt;Update:&lt;/font&gt; See also &lt;a href="http://blogs.msdn.com/csharpfaq/archive/2009/10/01/dynamic-in-c-4-0-introducing-the-expandoobject.aspx" tooltip="linkalert-tip" mce_href="http://blogs.msdn.com/csharpfaq/archive/2009/10/01/dynamic-in-c-4-0-introducing-the-expandoobject.aspx"&gt;this article about the ExpandoObject&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/csharpfaq/archive/2009/10/19/dynamic-in-c-4-0-creating-wrappers-with-dynamicobject.aspx" tooltip="linkalert-tip" mce_href="http://blogs.msdn.com/csharpfaq/archive/2009/10/19/dynamic-in-c-4-0-creating-wrappers-with-dynamicobject.aspx"&gt;this article about DynamicObject&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7217121" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Source/default.aspx">Source</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tips/default.aspx">Tips</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Forcing event unsubscription</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/09/09/forcing-event-unsubscription.aspx</link><pubDate>Tue, 08 Sep 2009 22:37:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7196908</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7196908</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/09/09/forcing-event-unsubscription.aspx#comments</comments><description>&lt;p&gt;Given my own experience, I'd say that events are the main source of leaks in .NET. They deserve double- and even triple-checks. Each time you add a subscription to an event in your code, most likely with +=, you should worry about the consequences and ask yourself whether you need to add a -= somewhere to unsubscribe from the event. If you have to, do it immediately before you forget about it. Often, you'll do that in a Dispose method.&lt;/p&gt;

&lt;p&gt;Don't forget that subject objects keep the observer (or listener, or subscriber) objects that observe them alive. See &lt;a href="http://weblogs.asp.net/fmarguerie/archive/2004/07/27/198489.aspx" mce_href="http://weblogs.asp.net/fmarguerie/archive/2004/07/27/198489.aspx"&gt;this post of mine&lt;/a&gt; if you need a refresher about the subject.&lt;/p&gt;

&lt;div&gt;&lt;a href="http://weblogs.asp.net/fmarguerie/archive/2004/07/27/198489.aspx" mce_href="http://weblogs.asp.net/fmarguerie/archive/2004/07/27/198489.aspx"&gt;&lt;img src="http://madgeek.com/dotnetweblogs/Images/ObserverReference.png" tooltip="linkalert-tip" mce_src="http://madgeek.com/dotnetweblogs/Images/ObserverReference.png" border="0" height="89" width="350"&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;Having listener objects unsubscribe from the events they subscribe to is usually the recommended way to ensure they can be collected. However, when you absolutely know that a subject object wont publish notifications anymore and you wish that its subscribers can be released, you can force the removal of all the subscriptions to the subject object. Here is how this can be achieved:&lt;/p&gt;

&lt;p&gt;&lt;strike&gt;&lt;font color="#000099" face="courier new,courier"&gt;&lt;font size="2"&gt;if (SomeEvent != null)&lt;br&gt;{&lt;br&gt;&amp;nbsp; foreach (EventHandler handler in SomeEvent.GetInvocationList())&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SomeEvent -= handler;&lt;br&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/strike&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#006600"&gt;Update:&lt;/font&gt; As suggested by Steve in a comment, &lt;b&gt;SomeEvent = null&lt;/b&gt; is enough!&lt;br&gt;&lt;font color="#006600"&gt;Update:&lt;/font&gt; I've improved the sample source code to show if the listeners are dead or alive.&lt;br&gt;&lt;font color="#006600"&gt;Update:&lt;/font&gt; See also &lt;a href="http://weblogs.asp.net/fmarguerie/archive/2009/11/03/article-detect-avoid-memory-leaks.aspx" mce_href="http://weblogs.asp.net/fmarguerie/archive/2009/11/03/article-detect-avoid-memory-leaks.aspx"&gt;this new article of mine&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;I have a &lt;a href="http://madgeek.com/Samples/ForceDisconnection.090908.zip" tooltip="linkalert-tip" mce_href="http://madgeek.com/Samples/ForceDisconnection.090908.zip"&gt;code sample available for you to download&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7196908" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Source/default.aspx">Source</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tips/default.aspx">Tips</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category></item><item><title>The "Error creating window handle" exception and the Desktop Heap</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/08/07/cannot-create-window-handle-desktop-heap.aspx</link><pubDate>Fri, 07 Aug 2009 16:36:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7163565</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7163565</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/08/07/cannot-create-window-handle-desktop-heap.aspx#comments</comments><description>&lt;b&gt;"Error creating window handle"&lt;/b&gt;

&lt;p&gt;When a big Windows Forms application I'm working on for a client is used actively, users often get "Error creating window handle" exceptions.&lt;/p&gt;

&lt;p&gt;Aside from the fact that the application consumes too much resources, which is a separate issue altogether that we are already addressing, we had difficulties with determining what resources were getting exhausted as well as what the limits are for these resources.&lt;br&gt;We first thought about keeping an eye on the Handles counter in the Windows Task Manager. That was because we noticed that some processes tended to consume more of these resources than they normally should. However, this counter is not the good one because it keeps track of resources such as files, sockets, processes and threads. These resources are named &lt;a href="http://msdn.microsoft.com/en-us/library/ms724485%28VS.85%29.aspx" tooltip="linkalert-tip" rel="nofollow"&gt;Kernel Objects&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The other kinds of resources that we should keep an eye on are the GDI Objects and the User Objects. You can get &lt;a href="http://msdn.microsoft.com/en-us/library/ms724515%28VS.85%29.aspx" tooltip="linkalert-tip" mce_href="http://msdn.microsoft.com/en-us/library/ms724515%28VS.85%29.aspx"&gt;an overview of the three categories of resources on MSDN&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;

&lt;b&gt;User Objects&lt;/b&gt;

&lt;p&gt;Window creation issues are directly related to &lt;a href="http://msdn.microsoft.com/en-us/library/ms725486%28VS.85%29.aspx" tooltip="linkalert-tip" mce_href="http://msdn.microsoft.com/en-us/library/ms725486%28VS.85%29.aspx"&gt;User Objects&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We tried to determine what the limit is in terms of User Objects an application can use.&lt;br&gt;There is a quota of 10,000 user handles per process. This value &lt;a href="http://msdn.microsoft.com/en-us/library/ms725486%28VS.85%29.aspx" tooltip="linkalert-tip" mce_href="http://msdn.microsoft.com/en-us/library/ms725486%28VS.85%29.aspx"&gt;can be changed in the registry&lt;/a&gt;, however this limit was not the real show-stopper in our case.&lt;br&gt; The other limit is 66,536 user handles per Windows session. This limit is theoretical. In practice, you'll notice that it can't be reached. In our case, we were getting the dreaded "Error creating window handle" exception before the total number of User Objects in the current session reached 11,000.&lt;/p&gt;

&lt;b&gt;Desktop Heap&lt;/b&gt;

&lt;p&gt;We then discovered which limit was the real culprit: it was the "Desktop Heap".&lt;br&gt;By default, all the graphical applications of an interactive user session execute in what is named a "desktop". The resources allocated to such a desktop are limited (but configurable).&lt;br&gt;&lt;/p&gt;
Note: User Objects are what consumes most of the Desktop Heap's memory space. This includes windows.

&lt;p&gt;For more information about the Desktop Heap, you can refer to the very good articles published on the NTDebugging MSDN blog:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx" tooltip="linkalert-tip" rel="nofollow"&gt;Desktop Heap Overview&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://blogs.msdn.com/ntdebugging/archive/2007/07/05/desktop-heap-part-2.aspx" rel="nofollow"&gt;Desktop Heap, part 2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;b&gt;Desktop Heap Monitor (dheapmon.exe)&lt;/b&gt;

&lt;p&gt;It's possible to monitor the Desktop Heap usage thanks to a command line tool: &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=5cfc9b74-97aa-4510-b4b9-b2dc98c8ed8b&amp;amp;displaylang=en" tooltip="linkalert-tip" rel="nofollow"&gt;Desktop Heap Monitor (dheapmon.exe)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It would be interesting to monitor this usage directly from within applications to prevent crashes. We could let users know that all the resources are about to be exhausted, and ask them to close windows and prevent them from opening new screens. This would help to avoid the "Error creating window handle" errors. When these exceptions occur, it's difficult to handle them gracefully and it's often too late to react because the application is in an unstable state.&lt;/p&gt;
&lt;p&gt;Unfortunately, it's not possible to consult the usage of the desktop heap programmatically from an application. The dheapmon.exe tool is based on a kernel mode driver (a .sys file) for collecting the data it returns.&lt;/p&gt;
&lt;p&gt;A solution could be to &lt;a href="http://msdn.microsoft.com/en-us/library/ms682124%28VS.85%29.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms682124%28VS.85%29.aspx"&gt;create a new desktop&lt;/a&gt;, dedicated to the application. In practice, this is not viable though because only one desktop can be visible at a time. &lt;br&gt;&lt;/p&gt;
&lt;p&gt;Another solution is to &lt;a href="http://support.microsoft.com/?scid=kb%3Ben-us%3B126962&amp;amp;x=10&amp;amp;y=11" tooltip="linkalert-tip" rel="nofollow"&gt;increase the size of the Desktop Heap&lt;/a&gt;. We can, for example, replace the second value by default of SharedSection (3072) by 4096. Yay, more resources to waste!&lt;br&gt;&lt;/p&gt;

&lt;b&gt;What's the real solution? Be green!&lt;/b&gt;

&lt;p&gt;Increasing the Desktop Heap is an effective solution, but that's not the ultimate one. The real solution is to consume less resources (less window handles in our case). I can guess how disappointed you can be with this solution. Is this really all what I can come up with??&lt;br&gt;Well, there is no big secret here. The only way out is to be lean. Having less complicated UIs is a good start. It's good for resources, it's good for usability too. The next step is to avoid waste, to preserve resources, and to recycle them!&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Here is how we're doing this in my client's application:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;We use TabControls and we create the content of each tab on the fly, when it becomes visible;&lt;/li&gt;
&lt;li&gt;We use expandable/collapsible regions, and again fill them with controls and data only when needed;&lt;/li&gt;
&lt;li&gt;We release resources as soon as possible (using the Dispose method). When a region is collapsed, it's possible to clear it's child controls. The same for a tab when it becomes hidden;&lt;/li&gt;
&lt;li&gt;We use the &lt;a href="http://msdn.microsoft.com/en-us/library/cc304760.aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc304760.aspx"&gt;MVP design pattern&lt;/a&gt;, which helps in making the above possible because it separates data from views;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;We use layout engines, the standard FlowLayoutPanel and TableLayoutPanel ones, or custom ones, instead of creating deep hierarchies of nested panels, GroupBoxes and Splitters (an empty splitter itself consumes three window handles...).&lt;/li&gt;
&lt;/ul&gt;
The above are just hints at what you can do if you need to build rich Windows Forms screens. There's not doubt that you can find other approaches.&lt;br&gt;The first thing you should do in my opinion is building your applications around use cases and scenarios. This helps in displaying only what's needed at a given time, and for a given user.&lt;br&gt;&lt;br&gt;Of course, another solution would be to use a system that doesn't rely on handles... WPF anyone?&lt;br&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7163565" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tools/default.aspx">Tools</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tips/default.aspx">Tips</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/UI/default.aspx">UI</category></item><item><title>LINQ in Action is now available in Chinese (LINQ实战) and in English in India</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/07/22/linq-chinese-india.aspx</link><pubDate>Wed, 22 Jul 2009 20:54:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7153022</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7153022</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/07/22/linq-chinese-india.aspx#comments</comments><description>&lt;p&gt;After English, &lt;a href="http://linqinaction.net/blogs/main/archive/2008/08/28/linq-im-einsatz-linq-in-action-in-german.aspx"&gt;German&lt;/a&gt;, &lt;a href="http://linqinaction.net/blogs/main/archive/2009/04/17/linq-in-action-in-spanish.aspx"&gt;Spanish&lt;/a&gt;, and &lt;a href="http://linqinaction.net/blogs/main/archive/2009/05/20/linq-em-a-o-linq-in-action-in-portuguese.aspx" mce_href="http://linqinaction.net/blogs/main/archive/2009/05/20/linq-em-a-o-linq-in-action-in-portuguese.aspx"&gt;Portuguese&lt;/a&gt;, &lt;a href="http://linqinaction.net" tooltip="linkalert-tip" mce_href="http://linqinaction.net"&gt;LINQ in Action&lt;/a&gt; is now available in &lt;b&gt;Chinese (中文)&lt;/b&gt;.&lt;/p&gt;&lt;p&gt;The title is &lt;b&gt;LINQ实战&lt;/b&gt;. The publisher is &lt;a href="http://www.ptpress.com.cn/Book.aspx?id=16848" mce_href="http://www.ptpress.com.cn/Book.aspx?id=16848"&gt;人民邮电出版社&lt;/a&gt; (Posts &amp;amp; Telecom Press). The book is also available on &lt;a href="http://www.amazon.cn/mn/detailApp?prodid=bkbk907926" mce_href="http://www.amazon.cn/mn/detailApp?prodid=bkbk907926"&gt;Amazon.cn/joyo&lt;/a&gt; and several other bookstores.&lt;/p&gt;&lt;p&gt;In addition to all the translations, LINQ in Action has been &lt;a href="http://www.dreamtechpress.com/display.asp?isbn=978-81-7722-882-3" mce_href="http://www.dreamtechpress.com/display.asp?isbn=978-81-7722-882-3"&gt;republished in English in &lt;b&gt;India&lt;/b&gt; by DreamTech Press&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;
&lt;br&gt;&lt;i&gt;Cross-posted from &lt;a href="http://linqinaction.net/"&gt;http://linqinaction.net&lt;/a&gt;&lt;/i&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7153022" width="1" height="1"&gt;</description></item><item><title>Who deserves a free MSDN subscription?</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/06/29/who-deserves-a-free-msdn-subscription.aspx</link><pubDate>Mon, 29 Jun 2009 15:54:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7136556</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7136556</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/06/29/who-deserves-a-free-msdn-subscription.aspx#comments</comments><description>&lt;p&gt;I have a free one-year MSDN subscription to offer. I believe that it has to be activated before June 30, so, I don't have time to organize a contest or something...&lt;/p&gt;&lt;p&gt;The offer is &lt;a href="http://msdn.microsoft.com/en-us/subscriptions/subscriptionschart.aspx" mce_href="http://msdn.microsoft.com/en-us/subscriptions/subscriptionschart.aspx"&gt;MSDN Premium&lt;/a&gt;, which gives you access to a whole set of Microsoft software licensed for design, development, testing, and demonstration of your programs. This includes Visual Studio Team Suite, Windows, Office, SQL Server, etc. Given the releases expected this year, this will give you access to such things as Visual Studio 2010 and Windows 7.&lt;br&gt;&lt;/p&gt;&lt;p&gt;If you think that you deserve to get this subscription, just &lt;strike&gt;contact me and let me know why I should give YOU this gift&lt;/strike&gt;. I'll make my choice quickly and I'll reply to you.&lt;br&gt;Hint: if you can help me update the content of &lt;a href="http://SharpToolbox.com" mce_href="http://SharpToolbox.com"&gt;SharpToolbox.com&lt;/a&gt;, that can be a plus for you ;-)&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;font color="#009900"&gt;UPDATE: We have a winner! Thanks to everyone who participated. I'll reply shortly to each one of you.&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7136556" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tools/default.aspx">Tools</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/_2800_Sharp_7C00_Java_2900_Toolbox/default.aspx">(Sharp|Java)Toolbox</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category></item><item><title>LINQ in Action XML samples now in LINQPad too</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/06/28/linq-in-action-xml-samples-now-in-linqpad-too.aspx</link><pubDate>Sun, 28 Jun 2009 20:58:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7136054</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7136054</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/06/28/linq-in-action-xml-samples-now-in-linqpad-too.aspx#comments</comments><description>&lt;p&gt;After &lt;a href="http://linqinaction.net/blogs/main/archive/2009/06/06/linq-in-action-samples-in-linqpad.aspx" mce_href="http://linqinaction.net/blogs/main/archive/2009/06/06/linq-in-action-samples-in-linqpad.aspx"&gt;we published the code samples for LINQ in Action's first chapters in LINQPad&lt;/a&gt; a few weeks ago, the samples of three more chapters have just been added. These chapters cover LINQ to XML. Thanks &lt;a href="http://www.thinqlinq.com/Default/LINQ-in-Action-XML-samples-added-to-LINQPad.aspx" mce_href="http://www.thinqlinq.com/Default/LINQ-in-Action-XML-samples-added-to-LINQPad.aspx"&gt;Jim&lt;/a&gt; for doing the additional conversion.&lt;br&gt;&lt;/p&gt;&lt;p&gt;The code samples for chapters 1 to 11 are now available. Read &lt;a href="http://linqinaction.net/blogs/main/archive/2009/06/06/linq-in-action-samples-in-linqpad.aspx" mce_href="http://linqinaction.net/blogs/main/archive/2009/06/06/linq-in-action-samples-in-linqpad.aspx"&gt;the original announcement&lt;/a&gt; to learn how to download and use these samples. A new download is enough to get the update.&lt;br&gt;&lt;/p&gt;
&lt;br&gt;&lt;i&gt;Cross-posted from &lt;a href="http://linqinaction.net/"&gt;http://linqinaction.net&lt;/a&gt;&lt;/i&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7136054" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Source/default.aspx">Source</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/LINQ/default.aspx">LINQ</category></item><item><title>LINQ in Action samples in LINQPad</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/06/06/linq-in-action-samples-in-linqpad.aspx</link><pubDate>Sat, 06 Jun 2009 13:12:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7109662</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7109662</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/06/06/linq-in-action-samples-in-linqpad.aspx#comments</comments><description>&lt;a href="http://linqpad.net" mce_href="http://linqpad.net"&gt;&lt;img src="http://linqinaction.net/photos/main/images/4804/original.aspx" title="LINQPad logo" alt="LINQPad logo" mce_src="http://linqinaction.net/photos/main/images/4804/original.aspx" style="float: right; margin-left: 5px; margin-bottom: 5px;" width="150" border="0" height="144"&gt;&lt;/a&gt;

&lt;p&gt;Do you know &lt;a href="http://linqpad.net/" mce_href="http://linqpad.net/"&gt;LINQPad&lt;/a&gt;? It's a really simple but great tool for testing LINQ queries. Not only that, but it can be used to test all kinds of C# and VB code snippets.&lt;/p&gt;

&lt;p&gt;Another great thing about LINQPad is that it comes with code samples. Until now the integrated code samples came from the &lt;a href="http://www.albahari.com/nutshell/" mce_href="http://www.albahari.com/nutshell/"&gt;C# 3.0 in a Nutshell&lt;/a&gt; book. Joe Albahari, author of LINQPad and C# 3.0 in a Nutshell, has opened LINQPad so that code samples from other books can be integrated into LINQPad. Thanks Joe for this opportunity!&lt;/p&gt;

&lt;p&gt;We worked with Joe to integrate LINQ in Action's code samples into LINQPad. The result is that in addition to being &lt;a href="http://linqinaction.net/files/folders/linqinaction/entry1952.aspx" mce_href="http://linqinaction.net/files/folders/linqinaction/entry1952.aspx"&gt;available as Visual Studio solutions and projects&lt;/a&gt;, you can now run our code samples directly from LINQPad. This makes it very easy to explore LINQ's features with instant "code and play".&lt;/p&gt;

&lt;p&gt;To install LINQ in Action's code samples in LINQPad, all you have to do is click on the "Download more samples..." link:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://linqinaction.net/photos/main/images/4805/original.aspx" mce_src="http://linqinaction.net/photos/main/images/4805/original.aspx" width="587" height="294"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;You'll see LINQ in Action proposed as one of the LINQPad-enabled books (the only one at the moment, in fact):&lt;/p&gt;
&lt;p&gt;&lt;img src="http://linqinaction.net/photos/main/images/4806/original.aspx" mce_src="http://linqinaction.net/photos/main/images/4806/original.aspx" width="500" height="355"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Once you've clicked on "Download full code listings into LINQPad", you should see the C# and VB samples grouped by chapter:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://linqinaction.net/photos/main/images/4807/original.aspx" mce_src="http://linqinaction.net/photos/main/images/4807/original.aspx"&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Currently, chapters 1 to 8 are available. We'll integrate the remaining code samples soon.&lt;/p&gt;

&lt;p&gt;Have fun with LINQ! &lt;br&gt;&lt;/p&gt;

&lt;br&gt;&lt;i&gt;Cross-posted from &lt;a href="http://linqinaction.net/"&gt;http://linqinaction.net&lt;/a&gt;&lt;/i&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7109662" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Source/default.aspx">Source</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tools/default.aspx">Tools</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/LINQ/default.aspx">LINQ</category></item><item><title>Modern censorship you shouldn't ignore</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/05/22/modern-censorship.aspx</link><pubDate>Fri, 22 May 2009 21:29:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7094979</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7094979</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/05/22/modern-censorship.aspx#comments</comments><description>&lt;p&gt;Should I need a reason to hate Apple, it would be &lt;a href="http://www.itwriting.com/blog/1470-apple-censors-iphone-application-threatens-developer-livelihood.html" mce_href="http://www.itwriting.com/blog/1470-apple-censors-iphone-application-threatens-developer-livelihood.html"&gt;censorship&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is not the first time Apple censors an application on the iPhone, but &lt;a href="http://www.itwriting.com/blog/1470-apple-censors-iphone-application-threatens-developer-livelihood.html" mce_href="http://www.itwriting.com/blog/1470-apple-censors-iphone-application-threatens-developer-livelihood.html"&gt;this time&lt;/a&gt; it's scarier.&lt;br&gt;
They censor software, and they censor books. Are users of iPhones and Apple products fully aware of such things? As consumers, you have the power to react.&lt;/p&gt;
&lt;p&gt;This is also ridiculous. As wondered in &lt;a href="http://www.blog.montgomerie.net/whither-eucalyptus" mce_href="http://www.blog.montgomerie.net/whither-eucalyptus"&gt;the original blog post&lt;/a&gt;, how is that different from using the built-in browser of the iPhone to access the same public content?&lt;/p&gt;
&lt;p&gt;
&lt;object width="445" height="364"&gt;
&lt;param name="movie" value="http://www.youtube.com/v/OYecfV3ubP8&amp;amp;hl=fr&amp;amp;fs=1&amp;amp;rel=0&amp;amp;color1=0x5d1719&amp;amp;color2=0xcd311b"&gt;
&lt;param name="allowFullScreen" value="true"&gt;
&lt;param name="allowscriptaccess" value="always"&gt;
&lt;embed src="http://www.youtube.com/v/OYecfV3ubP8&amp;amp;hl=fr&amp;amp;fs=1&amp;amp;rel=0&amp;amp;color1=0x5d1719&amp;amp;color2=0xcd311b" mce_src="http://www.youtube.com/v/OYecfV3ubP8&amp;amp;hl=fr&amp;amp;fs=1&amp;amp;rel=0&amp;amp;color1=0x5d1719&amp;amp;color2=0xcd311b" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"&gt;&lt;/object&gt;
&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7094979" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Opinions/default.aspx">Opinions</category></item><item><title>New York Times abandons WPF and Silverlight in favor of AIR</title><link>http://weblogs.asp.net/fmarguerie/archive/2009/05/22/new-york-times-abandons-wpf-and-silverlight-in-favor-of-air.aspx</link><pubDate>Fri, 22 May 2009 14:25:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7094750</guid><dc:creator>Fabrice Marguerie</dc:creator><slash:comments>23</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/fmarguerie/rsscomments.aspx?PostID=7094750</wfw:commentRss><comments>http://weblogs.asp.net/fmarguerie/archive/2009/05/22/new-york-times-abandons-wpf-and-silverlight-in-favor-of-air.aspx#comments</comments><description>&lt;p&gt;The first version of &lt;a href="http://nytimes.com/timesreader" mce_href="http://nytimes.com/timesreader"&gt;the New York Times Reader&lt;/a&gt; was showcased in 2006 as one of the first and major WPF applications. Then, the Times Reader was ported to Silverlight, so it can work on non-Windows platforms such as Mac OS and Linux. The fact that WPF runs only on Windows was indeed a major concern for such a product.&lt;/p&gt;&lt;p&gt;The move to Silverlight was not a big success. The Silverlight version of the Times Reader suffered from technical issues and political rejection from Apple users.&lt;br&gt;There were hundreds of comments on the homepage of the Silverlight version. Roughtly half of them where related to technical problems, half to rejection. Many Apple users don't want to use Microsoft products.&lt;br&gt;Technical issues can be solved (over time), but solving rejection is another story (and I don't think it can be solved). &lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://firstlook.blogs.nytimes.com/2009/05/12/times-reader-20-is-now-available/" mce_href="http://firstlook.blogs.nytimes.com/2009/05/12/times-reader-20-is-now-available/"&gt;Version 2.0 of the Times Reader has been released recently&lt;/a&gt;, and what is interesting is that WPF and Silverlight have been dropped in favor of Adobe AIR.&lt;br&gt;No more political issues, a single code base, and less technical issues it seems.&lt;br&gt;&lt;/p&gt;&lt;p&gt;This is a very interesting move. In fact, when I had to choose a technology for a new product a couple of months ago, I chose AIR too. As a .NET expert, I have of course considered WPF and Silverlight, but I had the same concerns as the New York Times.&lt;br&gt;A requirement was that the product should run on major platforms (Windows AND Mac at least), and even if Silverlight works on Macs, it was not a good choice for the same technical and political issues that the Times Reader faced. One big showstopper was the inability to create standalone desktop applications with Silverlight. It should be noted that Silverlight 3's out-of-browser mode won't be an answer to this because of its intrinsic limitations. AIR is much more powerful, with deeper desktop integration (such as file system access).&lt;br&gt;&lt;/p&gt;&lt;p&gt;It will be interesting to follow what will happen over time, but in my book, Flash/Flex and AIR have a lot of advantages right now compared to WPF and Silverlight.&lt;br&gt;I believe also that the battle is not only on the Web and the desktop, but also on mobile devices. Something tells me that we'll see Flash on Android, iPhone and Pre before Silverlight. And that will make a big difference.&lt;/p&gt;&lt;p&gt;More about the new version of the Times Reader &lt;a href="http://www.infoq.com/news/2009/05/Times-AIR-Reader" mce_href="http://www.infoq.com/news/2009/05/Times-AIR-Reader"&gt;here&lt;/a&gt;, &lt;a href="http://www.itwriting.com/blog/1424-new-york-times-switches-from-wpfsilverlight-to-flash-for-reader-2.html" mce_href="http://www.itwriting.com/blog/1424-new-york-times-switches-from-wpfsilverlight-to-flash-for-reader-2.html"&gt;here&lt;/a&gt; and &lt;a href="http://firstlook.blogs.nytimes.com/2009/05/08/sneak-peek-of-times-reader-20/" mce_href="http://firstlook.blogs.nytimes.com/2009/05/08/sneak-peek-of-times-reader-20/"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;font color="#006600"&gt;Update:&lt;/font&gt; &lt;a href="http://firstlook.blogs.nytimes.com/2008/05/22/times-reader-beta-for-the-mac-now-available/" mce_href="http://firstlook.blogs.nytimes.com/2008/05/22/times-reader-beta-for-the-mac-now-available/"&gt;Here is the post that announced the original version for the Mac&lt;/a&gt;, based on Silverlight. I read a few months ago the comments made on this post. Have a look, it's very instructive. Oh of course, silly people posted comments there too...&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7094750" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/News/default.aspx">News</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Tools/default.aspx">Tools</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/Opinions/default.aspx">Opinions</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/fmarguerie/archive/tags/UI/default.aspx">UI</category></item></channel></rss>