<?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>Omar Shahine's WebLog : Programming</title><link>http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx</link><description>Tags: Programming</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Office 2003 Redistributable Primary Interop Assemblies</title><link>http://blogs.msdn.com/omars/archive/2005/04/23/411032.aspx</link><pubDate>Sat, 23 Apr 2005 05:32:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:411032</guid><dc:creator>omars</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/omars/comments/411032.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=411032</wfw:commentRss><description>&lt;P&gt;I can't even begin to explain how happy I am that we recently &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=3c9a983a-ac14-4125-8ba0-d36d67e0f4ad&amp;amp;DisplayLang=en"&gt;released the Office 2003 PIA download&lt;/A&gt;. Why am I excited? Just &lt;A href="http://josheinstein.com/journal/archive/2005/01/21/340.aspx"&gt;read this&lt;/A&gt; and you will understand. I've known about this for a while but I had to keep my mouth shut :-).&lt;/P&gt;
&lt;P&gt;Not being able to install the PIAs is the single biggest deployment issue I've had with my Send to OneNote from Outlook PowerToy. I have about 10 emails in my inbox from users who could not install it and up till now I had nothing really to tell them except "sorry".&lt;/P&gt;
&lt;P&gt;Well, I plan on releasing a new version of Send to OneNote from Outlook that includes the redistributable, as well as a few dozen bug fixes and minor features.&lt;/P&gt;
&lt;P&gt;I really appreciate the work that the office folks did in releasing this. They listened to me yell and scream for a few months about this problem, and they fixed it. Thanks guys!&lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=58245c46-94d8-47c5-a6a9-dfbe8d58ad43"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=411032" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item><item><title>Programming Mac vs Windows</title><link>http://blogs.msdn.com/omars/archive/2005/03/19/399133.aspx</link><pubDate>Sun, 20 Mar 2005 03:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:399133</guid><dc:creator>omars</dc:creator><slash:comments>14</slash:comments><comments>http://blogs.msdn.com/omars/comments/399133.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=399133</wfw:commentRss><description>&lt;P&gt;David Weller &lt;A href="http://blogs.msdn.com/dweller/archive/2005/03/17/398198.aspx"&gt;discusses&lt;/A&gt; what it's like to program on a Mac. Back when I was a Mac user, I desperately wanted to write some programs. The barrier to entry was huge. I didn't know C++, didn't know Java, and still don't know Objective C (and don't care to ever learn). There was AppleScript and that is where I wrote all my stuff. Later I learned Java (in college), but all that really taught me was what object oriented programming was about, and for that I'm forever grateful. However, I still couldn't do anything with Java on a Mac because the JVM sucked big time. Not to mention Java apps looked funny with all their non standard controls.&lt;/P&gt;
&lt;P&gt;Anyway, this little company called &lt;A href="http://www.realsoftware.com/"&gt;REALSoftware&lt;/A&gt; came out with a product called REALBasic and I was hooked. For many years after that I wrote a bunch of stuff using REALBasic, and wrote most of my prototypes for Outlook Express and Entourage with that application. Then, I discovered .NET, Visual Studio and have been hooked since. I think the pivital moment for me, the one where I thought I could no longer work on the Mac was when I went to the PDC in 2003. It &lt;STRONG&gt;opened my eyes&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;When OS X came out I took a look at the various products for writing code, and pretty much felt the same way as David. I was just perplexed. None of it was intuitive to me. Thankfully Apple has realized it has a good thing with AppleScript and has continued to invest in that platform. I hear that Mono is doing pretty well on Mac OS X these days, and if they can get Windows.Forms support that would rock.&lt;/P&gt;
&lt;P&gt;My good buddy &lt;A href="http://www.mikefullerton.com/blog/PermaLink.aspx?guid=1ef05b7e-e0a3-4b6d-9a15-363a019d81cf"&gt;Mike Fullerton&lt;/A&gt; has been writing Mac software for most of his life. He has been around the block, writing games for big game developers, working on one of the first "Frameworks", &lt;A href="http://developer.apple.com/tools/macapp/"&gt;MacApp&lt;/A&gt;, is &lt;A href="http://www.mactech.com/articles/mactech/Vol.13/13.05/TidyHeap/index.html"&gt;published in MacTech&lt;/A&gt;, and then spending almost 7 years working on MacIE, MacOE, and Entourage. Recently Mike started working on the Hotmail team and it's fascinating to talk to him about writing .NET code. We joke that he thinks it's so "easy". I hope he writes more on &lt;A href="http://www.mikefullerton.com/blog/PermaLink.aspx?guid=1ef05b7e-e0a3-4b6d-9a15-363a019d81cf"&gt;the topic&lt;/A&gt; some day, as he has an awesome perspective. Not too many developers go this path. &lt;/P&gt;
&lt;P&gt;[update: corrected PDC date]&lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=52c0a0a8-eee0-4925-97ce-5eeeba1aa554"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=399133" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item><item><title>Send to SmugMug</title><link>http://blogs.msdn.com/omars/archive/2005/02/08/368883.aspx</link><pubDate>Tue, 08 Feb 2005 13:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:368883</guid><dc:creator>omars</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/omars/comments/368883.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=368883</wfw:commentRss><description>&lt;P&gt;I love &lt;A href="http://www.smugmug.com/?referrer=hDBXAc8lccGdQ."&gt;SmugMug&lt;/A&gt; so much I wanted a &lt;EM&gt;really easy&lt;/EM&gt; way to get my pictures from my hard drive to &lt;A href="http://www.smugmug.com/?referrer=hDBXAc8lccGdQ."&gt;SmugMug&lt;/A&gt;. Enter &lt;A href="http://wiki.shahine.com/default.aspx/MyWiki.SendToSmugMug"&gt;Send to SmugMug&lt;/A&gt;. This application will install a little entry in your contextual menu for folder that says... "Send to SmugMug". When you select this, the contents of the folder (.jpg only) are displayed in a window that allows you to add them to an existing album, or to create a new album setting all the available options.&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG alt="Send to SmugMug" hspace=0 src="http://www.shahine.com/omar/content/binary/sendtosmugmug.png" align=baseline border=0&gt;&lt;/P&gt;
&lt;P&gt;The Application and Source are available for &lt;A href="http://wiki.shahine.com/default.aspx/MyWiki.SendToSmugMug"&gt;download&lt;/A&gt;. Included is a Class Library that exposes most of the SmugMug &lt;A href="http://www.smugmug.com/hack/xmlrpc-overview"&gt;XML-RPC API&lt;/A&gt;. I will release it when it's done, I have a few more methods to support. Once that happens you can plop this into your .NET app and program against SmugMug.&lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=b0547321-2e6f-46e1-8db0-1313620ab766"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=368883" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Software/default.aspx">Software</category><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item><item><title>Windows Indexing Service + ASP.NET = CannotDebug</title><link>http://blogs.msdn.com/omars/archive/2005/01/29/363189.aspx</link><pubDate>Sun, 30 Jan 2005 06:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:363189</guid><dc:creator>omars</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/omars/comments/363189.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=363189</wfw:commentRss><description>&lt;P&gt;Agrhhhhh! This is why I hate computers sometimes. Based on &lt;A href="http://weblog.infoworld.com/udell/2005/01/25.html#a1157"&gt;this post&lt;/A&gt; that I saw a few days ago I enabled the Indexing Service on Windows XP. Well all of a sudden I started getting:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;Parser Error Message: Access is denied: [name of .dll here]&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When debugging dasBlog. For 2 freaking hours I tried to figure out what was wrong, and then thanks to google found &lt;A href="http://support.microsoft.com/default.aspx?scid=kb;en-us;329065"&gt;this&lt;/A&gt;.&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;"If you use Index Server, you can exclude the Temporary ASP.NET Files directory from the folders that the Index Server scans. To do so, follow these steps."&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Lets see, the Indexing service is disabled by default. I enabled it so that I can use it. Why else would I do this? And why can't&amp;nbsp;aspnet_regiis exclude this directory from the Indexing Service? I hate computers sometimes.&lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=d8e3d387-d483-46de-86a3-4f6f9536b515"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=363189" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item><item><title>MovableType Blacklist for .NET</title><link>http://blogs.msdn.com/omars/archive/2005/01/22/358558.aspx</link><pubDate>Sat, 22 Jan 2005 12:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:358558</guid><dc:creator>omars</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/omars/comments/358558.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=358558</wfw:commentRss><description>&lt;P&gt;As I &lt;A href="http://www.shahine.com/omar/PermaLink,guid,f1f15d4e-e3aa-46b3-96ee-5b4db4fffe5b.aspx"&gt;promised&lt;/A&gt;, here is the code for the MovableType Blacklist that I wrote for dasBlog.&lt;/P&gt;
&lt;P&gt;There are three pieces to it:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;the &lt;A href="http://cvs.sourceforge.net/viewcvs.py/*checkout*/dasblogce/source/DasBlogUpgrader/ReferralBlackList.cs"&gt;IBlackList&lt;/A&gt; interface
&lt;LI&gt;The &lt;A href="http://cvs.sourceforge.net/viewcvs.py/*checkout*/dasblogce/source/DasBlogUpgrader/MovableTypeBlacklist.cs"&gt;MovableTypeBlacklist&lt;/A&gt; class 
&lt;LI&gt;The &lt;A href="http://cvs.sourceforge.net/viewcvs.py/*checkout*/dasblogce/source/DasBlogUpgrader/ReferralBlackList.cs"&gt;Factory Class&lt;/A&gt; that holds an instance of the MovableTypeBlacklist and the &lt;A href="http://cvs.sourceforge.net/viewcvs.py/dasblogce/source/DasBlogUpgrader/ReferralUrlBlacklist.cs?view=markup"&gt;ReferralUrlBlacklist&lt;/A&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Feel free to use in your ASP.NET application.&lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=3c8cfa01-7b43-432d-91dc-6a5cecb4b2d3"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=358558" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item><item><title>Programming Teaches</title><link>http://blogs.msdn.com/omars/archive/2005/01/14/352683.aspx</link><pubDate>Fri, 14 Jan 2005 12:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:352683</guid><dc:creator>omars</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/omars/comments/352683.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=352683</wfw:commentRss><description>&lt;P&gt;Sometimes I wonder if I was supposed to be a programmer. My job at Microsoft does not require that I write any code... that's not what Program Managers do. Instead I do all sorts of other stuff, but I enjoy it a great deal. However, sometimes all the context switching from multi tasking KILLS me. I mean if I am juggling 2-3 super high priority items at once I get really burned out.&lt;/P&gt;
&lt;P&gt;That is why I really enjoy programming so much in my spare time. I don't have to multi-task and I can focus on one problem at a time. I find that to be incredibly rewarding. The ability to create something from nothing, to take an idea and make it work all by myself. I sort of get to do that at Microsoft but the process is lengthy, I don't actually build the thing, and you often don't get that satisfaction till you "ship". Depending on where you work, that could be every 2 months to every 2-3 years, sometimes longer.&lt;/P&gt;
&lt;P&gt;The funny thing is, when I came to Microsoft I didn't really ever write code. I took two&amp;nbsp;4 months classes in college (C++ and Java). I hated C++ cause after&amp;nbsp;4 months all I could do was write a console app. Java was neat in that I could draw stuff, make games, silly and cool little apps in days. After that I pretty much never tried again. In May of 2003 I was frustrated at how difficult it was to add words to the Tablet PC Dictionary (which was supposed to improve recognition). I was on a mailing list where some one forwarded a word doc that described how to add words to the dictionary in VB.NET. I installed Visual Studio that day, and started to work on the application. I marveled at how cool the .NET&amp;nbsp;Framework was. I read a few dozen books, not understanding most of the stuff, but learning&amp;nbsp;little by little. I sent the application around to the Tablet Discussion List we have at Microsoft and&amp;nbsp;a few&amp;nbsp;days later I got an email from some folks on the tablet team asking me if I wanted to publish the application as a PowerToy.&lt;/P&gt;
&lt;P&gt;That was really thrilling for me. It demonstrated that I had the creative power to take my own idea and make something that people could download and use. Looking back at this application and the code, I can't help but laugh. I later rewrote the thing from scratch cause none of it made sense to me, and I had long since switched to using C#, so VB looked funny and confusing. Soon after that I discovered BlogX and started playing around with that. I was mostly interested in the Windows application for posting to BlogX but soon after I started to dive into ASP.NET which was a rather difficult thing to get my head wrapped around. My hunger for learning more, and doing more really accelerated. I wrote a bunch of &lt;A href="http://wiki.shahine.com/default.aspx/MyWiki.MySoftware"&gt;little applications, utilities&lt;/A&gt; etc and finally got most of it out of my system ;-). But the ability to do things like extending Media Center, Outlook and add value where I wanted was like an addictive drug. I was empowered to make things the way I want.&amp;nbsp;Such things were:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Making the Vacuum Fluorescent Display on my Media Center do something useful 
&lt;LI&gt;plugin for Outlook that could create OneNote notes from Emails and other items 
&lt;LI&gt;NewsGator plugin to post to dasBlog 
&lt;LI&gt;An application to edit the DateTime of photos as well as automatically rotate pictures 
&lt;LI&gt;A&amp;nbsp;small program to zip and unzip files quickly 
&lt;LI&gt;An application to clean all the cruft from a VS.NET project (bin, obj) 
&lt;LI&gt;An application to download RSS and send that to OneNote 
&lt;LI&gt;An Outlook toolbar to replace the GettingThingsDone toolbar out there (that I dislike) 
&lt;LI&gt;A Pocket PC Phone Edition app to switch the device to Vibrate during meetings 
&lt;LI&gt;A Smartphone app for calculating tips 
&lt;LI&gt;An ASP.NET Mobile Forms app for Wine that I have tried.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Some of these things I've &lt;A href="http://wiki.shahine.com/default.aspx/MyWiki.MySoftware"&gt;shipped&lt;/A&gt;, and others I haven't cause I don't have the time to finish the last 10% to make them shareable. Finally, the product that I currently am having the most fun working on, dasBlog, is also one that I have learned the greatest from. Both &lt;A href="http://staff.newtelligence.net/clemensv/"&gt;Clemens&lt;/A&gt; and &lt;A href="http://www.hanselman.com/blog/"&gt;Scott Hanselman&lt;/A&gt;&amp;nbsp;have taught me an immense amount about programming through their code, or through interactions with them. Scott actually spent a bunch of time the past few weeks chatting over IM, Skype and Phone explaining things to me, and is a really great teacher. Clemens wrote so much code in dasBlog that there are still parts of it that are teaching me new things, and some I don't quite fully understand. But each time I decide to tackle some area of the code base that I'm unfamiliar with, I learn a bunch load more. Fixing bugs forces you to understand and learn how things work, which is a great way to learn new stuff.&lt;/P&gt;
&lt;P&gt;The amazing thing about .NET is you can really take your skills and apply them to the Internet, Win32 apps, Mobile apps, Media Center&amp;nbsp;plugins, Tablet PC, Office, COM, etc. Knowing the language is an incredibly powerful tool and can be used consistently across a large spectrum of devices and products. I'm not sure you can do that with anything else. Since I am such a gear head, and out of the box never satisfies me, I have currently touched almost every product we sell that can be extended using .NET for about 12 months of investment of time on my part. That's a pretty decent value proposition for the framework. From my Smartphone to my Media Center, and everything in between, I can change things, make things, and custom tailor software to my liking.&lt;/P&gt;
&lt;P&gt;What's my point? Well I'm getting to that. In the last 18 months I have learned a crap load about programming and .NET. When I was in the MacBU this had zero relevance to my job. However, now in Hotmail it has a lot of relevance, especially since my team is responsible for the Front Door Architecture and Infrastructure. This means that I often spend an enormous amount of time with our developers thinking about .NET, designing for scale, solving problems when things break etc. The interesting thing is that every time I learn something new about programming or ASP.NET it comes up a few days later at work. This past month it's happened at least&amp;nbsp;twice. This means that I can actually play a part in the design or the solution for a problem, and help to actually influence direction and add value where I can. In many ways I feel like my job is a lot like being a student. I learn every day that I am here, in almost every meeting I am in, and from most of the people I interact with. I really find it rewarding to also learn from looking at other people's code and trying to influence my ideas into something that ships. That's really what makes working her addictive for me, and would really make it hard for me to do anything else at this point in my life.&lt;/P&gt;
&lt;P&gt;A lot of the time my wife looks at me staring at my computer screen and has no freaking idea what could be so interesting that I would glue myself to the same chair for hours typing away. Sometime I wonder myself, but often I hardly even notice. I've tried to explain it to her, but just like I can't understand what it's like to save some one's life, deliver their child, or help them create a baby when they cannot otherwise do so (things she does), it's hard for her to understand how this &lt;STRONG&gt;drives&lt;/STRONG&gt; me. I consider myself pretty dammed lucky that my ability to do my job benefits from this kind of learning, and that as I learn more, I can contribute more. It's sort of win-win I guess.&lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=34a3531b-ed71-4a5f-9cd8-a044cac9e7fc"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=352683" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item><item><title>Referral Spam and Movable Type Blacklist</title><link>http://blogs.msdn.com/omars/archive/2005/01/10/349793.aspx</link><pubDate>Mon, 10 Jan 2005 17:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:349793</guid><dc:creator>omars</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/omars/comments/349793.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=349793</wfw:commentRss><description>&lt;P&gt;Well, just in time for a wave of referral spam that is hitting my blog (mostly from &lt;A href="http://www.ownsthis.com/"&gt;http://www.ownsthis.com&lt;/A&gt;) I spent part of today writing a class that can consume the &lt;A href="http://www.jayallen.org/comment_spam/"&gt;Movable Type Blacklist&lt;/A&gt;. The class will allow you to download this file from the server periodically (no more than once a day). I have written it such that anyone can integrate this into their .Net blogging package, or any other .Net program. I just checked this into the dasBlog 1.7 tree. The nice thing about this is that the Blacklist is maintained in real time, and you won't have to rely just on content filtering (the stuff that &lt;A href="http://www.hanselman.com/blog/"&gt;Scott&lt;/A&gt; did) but you'll get a pretty long and decent blacklist of bad sites. So far, in the past few hours I've gotten 100% of the referral spam and no false positives...&lt;/P&gt;
&lt;P&gt;We are a few days away from releasing the final version of dasBlog 1.7. A &lt;A href="http://www.jeffsandquist.com/PermaLink,guid,acc1ffe6-9f38-465c-89cf-2b3e184e4c88.aspx"&gt;very&lt;/A&gt; &lt;A href="http://blog.seanalexander.com/PermaLink,guid,13727c0a-e1be-415b-8d25-dc2d5874b206.aspx"&gt;small&lt;/A&gt; number of folks have been running the bits over the weekend and as a result we've fixed a few bugs. A couple more days and we'll post the bits to SourceForge.&lt;/P&gt;
&lt;P&gt;When that happens I'll post the MovableTypeBlacklist class. I've also considered writing an HttpModule to send these guys 404s, but didn't really think that was appropriate. The list is basically loaded into a long string, delimited by "|" and passed into a Regex to match a url. Interestingly enough, when I tried to Compile the Regex, my little console app balooned to 150 MB and it never quite finished running. Using a static Regex with the long static string I was able to execute matches in 0 - 10 milliseconds.&lt;/P&gt;
&lt;P&gt;Here is a dump of the class:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;6p.org.uk : True&lt;BR&gt;Executed in : 20 milliseconds&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;microsoft.com : False&lt;BR&gt;Executed in : 0 milliseconds&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;shahine.com : False&lt;BR&gt;Executed in : 0 milliseconds&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;flatbedshipping.com : True&lt;BR&gt;Executed in : 0 milliseconds&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;apply-to-green-card.org : True&lt;BR&gt;Executed in : 0 milliseconds&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;ownsthis.com : True&lt;BR&gt;Executed in : 10 milliseconds&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=f1f15d4e-e3aa-46b3-96ee-5b4db4fffe5b"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=349793" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category><category domain="http://blogs.msdn.com/omars/archive/tags/dasBlog/default.aspx">dasBlog</category></item><item><title>Nullable Types</title><link>http://blogs.msdn.com/omars/archive/2005/01/08/349072.aspx</link><pubDate>Sat, 08 Jan 2005 15:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:349072</guid><dc:creator>omars</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/omars/comments/349072.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=349072</wfw:commentRss><description>&lt;P&gt;I'm pretty excited about &lt;A href="http://msdn.microsoft.com/vcsharp/2005/overview/language/nullabletypes/"&gt;Nullable Types&lt;/A&gt; in Whidbey. The primary reason I care about this is that in my &lt;A href="http://wiki.shahine.com/default.aspx/MyWiki.PhotoLibrary"&gt;PhotoLibrary&lt;/A&gt; (library that exposes EXIF properties of a picture) has lot of value types like int. One neat thing about the class is that using something like&amp;nbsp;a &lt;A href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformspropertygridclasstopic.asp"&gt;PropertyGrid&lt;/A&gt; you can just point it at the Photo object and it will automatically reflect all the meta data and display it (with very little work). Well if a Picture doesn't contain certain properties, the reference types simply don't appear because they are null. Well, unfortunately all the value types appear in the property grid because they are set to 0. I never found an easy to way filter these out, and there are quite a few EXIF properties out there, which leads to a lot of unnecessary data in the property grid.&lt;/P&gt;
&lt;P&gt;Anyway, this should fix that :-)&lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=746fc3c7-d54a-4faa-b98a-350686873dde"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=349072" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item><item><title>Dying Thread on Trackbacks, Referrals and Pingbacks</title><link>http://blogs.msdn.com/omars/archive/2005/01/06/347410.aspx</link><pubDate>Thu, 06 Jan 2005 12:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:347410</guid><dc:creator>omars</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/omars/comments/347410.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=347410</wfw:commentRss><description>&lt;P&gt;Part 2 of &lt;A href="http://www.shahine.com/omar/PermaLink,guid,1c62220c-7787-4728-a06c-093925f7787b.aspx"&gt;2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Bug 2: TrackingHandler Thread Dies&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Another problem that &lt;A href="http://www.hanselman.com/blog/"&gt;Scott Hanselman&lt;/A&gt; informed me of was that he would frequently stop receiving Trackbacks, Pingbacks and Referrals on his posts. Furthermore, it was intermittent. This was troubling since losing a Trackback means it's lost forever. Well we went hunting in the code, and thanks to some UnitTest of a theory I had found the answer.&lt;/P&gt;
&lt;P&gt;Basically the situation is this. Scott gets a lot of traffic. More than I do. There is a thread in dasBlog that sits around waiting for Trackbacks and the like. You use it by calling trackingQueue.Enqueue(tracking) and then trackingQueueEvent.Set(). So basically dasBlog can sit there and queue a bunch of trackings, and when it's ready the thread runs to execute them. The code looks like this:&lt;FONT size=2&gt;&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;private&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/SPAN&gt; TrackingHandler( )&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;while&lt;/SPAN&gt; ( &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/SPAN&gt; )&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Tracking tracking;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;trackingQueueEvent.WaitOne();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;while&lt;/SPAN&gt; ( &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/SPAN&gt; )&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;lock&lt;/SPAN&gt;( trackingQueue.SyncRoot )&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tracking &lt;SPAN style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/SPAN&gt; trackingQueue.Dequeue() &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;as&lt;/SPAN&gt; Tracking;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/SPAN&gt; ( tracking !&lt;SPAN style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/SPAN&gt; )&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;try&lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;InternalAddTracking( tracking );&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;catch&lt;/SPAN&gt; (Exception e)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ErrorTrace.Trace(TraceLevel.Error,e);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/SPAN&gt; ( trackingQueue.Count == 0 )&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;break&lt;/SPAN&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;FONT face=Verdana&gt;The objects below are created like so:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;trackingQueue &lt;SPAN style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/SPAN&gt; Queue();&lt;BR&gt;trackingQueueEvent &lt;SPAN style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/SPAN&gt; AutoResetEvent(&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;false&lt;/SPAN&gt;);&lt;BR&gt;trackingHandlerThread &lt;SPAN style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/SPAN&gt; Thread(&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/SPAN&gt; ThreadStart(&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/SPAN&gt;.TrackingHandler));&lt;BR&gt;trackingHandlerThread.IsBackground &lt;SPAN style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;true&lt;/SPAN&gt;;&lt;BR&gt;trackingHandlerThread.Start();&lt;/SPAN&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;/FONT&gt;So, can you figure out what is wrong? Well I created a unit test that called this 100 times. What I quickly found out was that even though the code was calling break when the trackingQueue.Count was equal to zero the trackingQueueEvent.WaitOne() call wasn't blocking the while loop from continuing. This caused trackingQueue.Dequeue() to throw an unhanded exception (which should have been in a try catch anyway). &lt;/P&gt;
&lt;P&gt;Not knowing a whole lot about this kind of threading I looked at a couple of docs and found the answer. Before calling break I added trackingQueueEvent.Reset(). Problem fixed (I hope). &lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=9bc569dd-c6af-49a8-8e5c-4976e55c4562"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=347410" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category><category domain="http://blogs.msdn.com/omars/archive/tags/dasBlog/default.aspx">dasBlog</category></item><item><title>DateTime.ToString("yyyy-MM-dd")</title><link>http://blogs.msdn.com/omars/archive/2005/01/06/347399.aspx</link><pubDate>Thu, 06 Jan 2005 11:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:347399</guid><dc:creator>omars</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/omars/comments/347399.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=347399</wfw:commentRss><description>&lt;P&gt;Recently I found the answer to two very hard questions about bugs in dasBlog. They were kinda tricky to figure out, but also really interesting (bug 2 will be in a follow up post)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Bug 1: DateTime.ToString()&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;One of the classes in dasBlog that stores information like Comments, Trackbacks and Pingbacks determines it's filename like so:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/SPAN&gt; FileName&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;/SPAN&gt; DateUtc.ToString(&lt;SPAN style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"yyyy-MM-dd"&lt;/SPAN&gt;) &lt;SPAN style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;".dayextra.xml"&lt;/SPAN&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Well a few weeks ago Scott Hanselman emailed me with some files with names like &lt;STRONG&gt;1425-05-05.dayextra&lt;/STRONG&gt;. Can you figure out why this is?&lt;/P&gt;
&lt;P&gt;Well as I found out, DateTime always assumes Gregorian Calendar, so DateTime.ToString() will output a filename with a Culture.Invariant filename. Well what happened to Scott is that he got comment spammed by some one who's Windows Region was set to a Culture that uses the &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemglobalizationhijricalendarclassgetdayofweektopic.asp"&gt;Hijri Calendar&lt;/A&gt;. So, 1425-05-05 is the equivalent of 2004-06-22. &lt;/P&gt;
&lt;P&gt;The reason this happened was because this person happened to be the &lt;STRONG&gt;first&lt;/STRONG&gt; person to leave a comment, and thus the file was created using the CultureInfo from their machine!&lt;/P&gt;
&lt;P&gt;The fix was to do the following:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/SPAN&gt; FileName&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;// Use Invariant Culture, not host culture (or user override),&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;for date formats.&lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;IFormatProvider mmddFormat &lt;SPAN style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/SPAN&gt; CultureInfo(String.Empty, &lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;false&lt;/SPAN&gt;);&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;// Ignore local DateFormatInfo (could say CCYY-DD-MM),&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;always use CCYY-MM-DD.&lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;/SPAN&gt; DateUtc.ToString(&lt;SPAN style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"yyyy-MM-dd"&lt;/SPAN&gt;, mmddFormat) &lt;SPAN style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;+&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;".dayfeedback.xml"&lt;/SPAN&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;DateTime stuff is very tricky and dasBlog has 4 different kinds of DateTime so it can get confusing.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;DateTime for Server (timezone the server is in) &lt;/LI&gt;
&lt;LI&gt;DateTime for Author (timezone the author is creating the post) &lt;/LI&gt;
&lt;LI&gt;UTC, which is how all data is saved &lt;/LI&gt;
&lt;LI&gt;Browser DateTime (where the reader is reading the post) &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;In all these cases dasBlog must know how to convert back and forth between all these formats and preserving the window of time that equals a single Day (24 hours of time, in the server, author, or UTC timezone). &lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=1c62220c-7787-4728-a06c-093925f7787b"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=347399" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category><category domain="http://blogs.msdn.com/omars/archive/tags/dasBlog/default.aspx">dasBlog</category></item><item><title>When ReleaseComObject is necessary in Outlook</title><link>http://blogs.msdn.com/omars/archive/2004/12/07/276136.aspx</link><pubDate>Tue, 07 Dec 2004 11:42:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:276136</guid><dc:creator>omars</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/omars/comments/276136.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=276136</wfw:commentRss><description>&lt;P&gt;Some might tell you that you never need to call Marhal.ReleaseComObject when writing managed code in Outlook. Well there are two very specific situations in which you must call RCO or else you will encounter problems. They are:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;You create toolbar buttons in new Inspector windows &lt;/LI&gt;
&lt;LI&gt;You use the Explorer.ActiveExplorer() method.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;This is also a good point to tell you that if you are going to call RCO, you need to use a shim or you will hose other add-ins that are running in the same Domain as Outlook (the default).&lt;/P&gt;
&lt;P&gt;You may also wan to read &lt;A href="http://blogs.msdn.com/eric_carter/archive/2004/10/10/240568.aspx"&gt;Eric Carter's post on Getting Outlook to shut down&lt;/A&gt; which offers a different approach for problem #2. I'm not sure if his approach fixes the corrupted folder list. He makes some great points in that post, and sadly in my case it is in fact necessary to call RCO (as far as I can tell).&lt;/P&gt;
&lt;P&gt;&lt;B&gt;1. Creating a Toolbar in new Inspector Windows&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;It's pretty common for an add-in developer that has created a toolbar to wish to have them appear in the Inspector windows. My Send to OneNote Powertoy does this, and I didn't find out about this problem till a few users reported it. Some kind folks at Microsoft told me how to work around it.&lt;/P&gt;
&lt;P&gt;Basically, what happens is this. Whenever you create or modify a new Sticky Note in Outlook, Outlook tries to add your toolbar button to the Inspector. However, you can't do that. Outlook deals with this by presenting the following two dialogs. The first happens if you Lock your computer, then unlock it. The second happens when you quit Outlook.&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG height=115 src="http://www.shahine.com/omar/content/binary/outlook_error_1.png" width=465 border=0&gt;&lt;/P&gt;
&lt;P align=center&gt;Exhibit A: "Could not complete the operation. One or more parameter values are not valid."&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG height=115 src="http://www.shahine.com/omar/content/binary/outlook_error_2.png" width=347 border=0&gt;&lt;/P&gt;
&lt;P align=center&gt;Exhibit B: "The note will close and your changes will not be saved."&lt;/P&gt;
&lt;P&gt;The solution to this problem is to:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Handle the OnNewInspector Event &lt;/LI&gt;
&lt;LI&gt;Call Marshal.ReleaseComObject on the Sticky Note Inspector&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;B&gt;Handle the OneNewInspector Event&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;See code below:&lt;/P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; OnStartupComplete(&lt;SPAN class=kwrd&gt;ref&lt;/SPAN&gt; Array custom)
{
    &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationInspectors = &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationObject.Inspectors;

    &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;
    {
        &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationInspectors.NewInspector += 
             &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; InspectorsEvents_NewInspectorEventHandler(OnNewInspector);
    }
    &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt; (Exception e)
    {
        Debug.WriteLine(e);
    }
}&lt;/PRE&gt;
&lt;P&gt;Where ApplicationInspectors is an instance of type Inspectors and ApplicationObject is an instance of Outlook.Application.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Call Marshal.ReleaseComObject on the Sticky Note Inspector&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;This is where you prevent the errors from happening.&lt;/P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; OnNewInspector(Inspector inspector)
{
    &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; item = inspector.CurrentItem;
    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (item &lt;SPAN class=kwrd&gt;is&lt;/SPAN&gt; NoteItem)
    {
        Marshal.ReleaseComObject(inspector);
        inspector = &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;;
    }
    &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;
    {
        / ... /
    }
    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (item != &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;)
    { 
        Marshal.ReleaseComObject(item);
        item = &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;;
    }
}
&lt;/PRE&gt;
&lt;P&gt;Problem solved. Now on to problem two which is more complicated.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;2. Handling Explorers in Outlook&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;It is very common for an Outlook add-in to use the Explorer object. If you are adding toolbars to the Explorer, or you are manipulating such things as messages, contacts etc, or you wish to get the selected item you need to call Explorer.ActiveExplorer(). The problem with calling this is that you can run into a situation where if you do not call RCO on the ActiveExplorer then you can cause Outlook to not persist the collapsed state of the folder list (all items will be collapsed when you restart) or even worse, Outlook won't close. I've found that Send to OneNote has both these problems. I wasn't aware of the collapse folder list bug till a few days ago, but I've known about the Outlook shutdown bug for months, but I could not explain it. The problem only seemed to happen when you had many add-ins installed. If my add-in was living on its own in Outlook I never saw any problems.&lt;/P&gt;
&lt;P&gt;In order to call Marshal.ReleaseComObject() on the Explorer that you are using you need to do some work.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a custom ExplorerCloseEvent class that holds on to the Explorer object &lt;/LI&gt;
&lt;LI&gt;Handle the OnExplorerClose event &lt;/LI&gt;
&lt;LI&gt;Call Marshal.ReleaseComObject on the closing Explorer&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The reason that you have to do this is because by default the Explorer.Close() event does not pass in the current Explorer, so you have to write your own class with it's own event handler to do this.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Create a custom ExplorerCloseEvent class that holds on to the Explorer object&lt;/B&gt;&lt;/P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; OfficeExplorerCloseEvent : IDisposable
{
    &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; Outlook.ExplorerEvents_Event explorer;
    &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; Handler handler;

    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;delegate&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; Handler(&lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; sender, EventArgs args);

    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; OfficeExplorerCloseEvent(&lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; explorer, Handler handler)
    {
        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (explorer == &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;)
            &lt;SPAN class=kwrd&gt;throw&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; ArgumentNullException(&lt;SPAN class=str&gt;"explorer"&lt;/SPAN&gt;);
        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (handler == &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;)
            &lt;SPAN class=kwrd&gt;throw&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; ArgumentNullException(&lt;SPAN class=str&gt;"handler"&lt;/SPAN&gt;);

        &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.explorer = (Outlook.ExplorerEvents_Event) explorer;
        &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.handler = handler;

        HookEvent();
    }

    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; Explorer
    {
        get
        {
            &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; (&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.explorer);
        }
    }

    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; Dispose()
    {
        &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.explorer.Close -= 
            &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Microsoft.Office.Interop.Outlook.ExplorerEvents_CloseEventHandler(&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ForwardExplorerEvent);
    }

    &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; HookEvent()
    {
        &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.explorer.Close +=
            &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Microsoft.Office.Interop.Outlook.ExplorerEvents_CloseEventHandler(&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ForwardExplorerEvent);
    }

    &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; ForwardExplorerEvent()
    {
        &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.handler(&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;, &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; EventArgs());
    }
}&lt;/PRE&gt;
&lt;P&gt;Handle the OnExplorerClose event. This code builds on the first code snippet of the OnStartupComplete() method.&lt;/P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; OnStartupComplete(&lt;SPAN class=kwrd&gt;ref&lt;/SPAN&gt; Array custom)
{
    &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationExplorers = &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationObject.Explorers;
    &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationInspectors = &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationObject.Inspectors;

    &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;
    {
        &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationInspectors.NewInspector += 
             &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; InspectorsEvents_NewInspectorEventHandler(OnNewInspector);
    }
    &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt; (Exception e)
    {
        Debug.WriteLine(e);
    }
    
    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationObject.Explorers.Count &amp;gt; 0)
    {
        &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationExplorer = &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationObject.ActiveExplorer();
        &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; OfficeExplorerCloseEvent(&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationObject.ActiveExplorer(), 
            &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; OfficeExplorerCloseEvent.Handler(&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.OnExplorerClose));
    }

    Marshal.ReleaseComObject(&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationObject.ActiveExplorer());
    Marshal.ReleaseComObject(&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;.ApplicationExplorer);
}&lt;/PRE&gt;
&lt;P&gt;As you can see in the last two lines I call RCO on the ActiveExplorer and the ApplicationExplorer (which is just an instance of the current Explorer). I'm not 100% sure if you have to do this, but I gave up debugging this nonsense after a few hours and just left it in there.&lt;/P&gt;
&lt;P&gt;You must also be sure to see if you have any existing Explorers before doing this as you don't want to hook the event unless Outlook is starting in UI mode (it can be instantiated through ActiveSync for example w/o any UI and in that case Explorers will not exist).&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Call Marshal.ReleaseComObject on the closing Explorer&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;Now that we have hooked the OnExplorerClose lets see what we do in that Method.&lt;/P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; OnExplorerClose(&lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; sender, EventArgs args)
{
    Explorer explorer = ((OfficeExplorerCloseEvent) sender).Explorer &lt;SPAN class=kwrd&gt;as&lt;/SPAN&gt; Explorer;
    ((IDisposable) sender).Dispose();


    &lt;SPAN class=kwrd&gt;while&lt;/SPAN&gt; (&lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;)
    {
        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (Marshal.ReleaseComObject(explorer) == 0)
        {
            &lt;SPAN class=kwrd&gt;break&lt;/SPAN&gt;;
        }
    }


    explorer = &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;;

    GC.Collect();
    GC.WaitForPendingFinalizers();
}
&lt;/PRE&gt;
&lt;P&gt;In the above code snippet I am getting the Explorer instance that the OfficeExplorerCloseEvent is holding, and calling RCO on it till the RefCount is 0. This ensures that the are all disposed. Then I call the GarbageCollector to clean things up for me.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Final Thoughts&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;I hope this shows you that doing what appears to be straightforward with managed code in Outlook isn't. I could write a few more blog posts about things I've encountered, and probably will when time permits. I'm pretty excited because for the first time in months, Outlook is shutting down cleanly 100% of the time!&lt;/P&gt;
&lt;P&gt;I would also like to thank all those folks that helped me with this problem, or provided code to guide me. I can't actually remember who helped me get this far...&lt;/P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;STYLE type=text/css&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/STYLE&gt;
&lt;PRE class=csharpcode&gt;&lt;/PRE&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=e8ef8ba0-be2d-4599-ab77-db2a1f5cf15c"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=276136" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item><item><title>CleanSources</title><link>http://blogs.msdn.com/omars/archive/2004/12/05/cleansources.aspx</link><pubDate>Mon, 06 Dec 2004 07:26:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275403</guid><dc:creator>omars</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/omars/comments/275403.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=275403</wfw:commentRss><description>&lt;P&gt;A while ago &lt;A href="http://www.shahine.com/omar/PermaLink,guid,4bca31d7-e5ae-4d10-ac6e-7a1d6c3a08e6.aspx"&gt;I lamented that the “Clean Project” button in VS.NET did nothing &lt;/A&gt;for .NET projects. I thought that it would be nice to have something that would empty the bin, obj, and setup folders of crusty stuff, or just nuke it if you plan on zipping your source to email to some one. There is really no need to send that stuff since the compiler will generate it all again later.&lt;/P&gt;
&lt;P&gt;So I whipped up a little application called &lt;A href="http://wiki.shahine.com/default.aspx/MyWiki.CleanSources"&gt;CleanSources&lt;/A&gt; that will do just that. The application will place a contextual menu when you right-click on a folder and it will then recursively go through and get rid of that stuff.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;update:&lt;/STRONG&gt; you really shuold get &lt;A href="http://www.codinghorror.com/blog/archives/000368.html"&gt;Jeff Atwood's Clean Sources Plus&lt;/A&gt;. It's much bettter than mine :-).&lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=eb375f5c-3219-4be8-8a61-7358bc69f2b9"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=275403" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item><item><title>Programming iTunes vs WMP in .NET</title><link>http://blogs.msdn.com/omars/archive/2004/12/03/274411.aspx</link><pubDate>Sat, 04 Dec 2004 01:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:274411</guid><dc:creator>omars</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/omars/comments/274411.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=274411</wfw:commentRss><description>&lt;P&gt;I find it creepy that it's a million times easier to write &lt;A href="http://blogs.msdn.com/dancre/archive/2004/11/30/272720.aspx"&gt;managed code against iTunes&lt;/A&gt; than Windows Media Player. That just seems wrong. A few weeks ago when I was &lt;A href="http://www.shahine.com/omar/PermaLink,guid,7133cf0a-9061-48cc-869a-5894fc470273.aspx"&gt;playing with the iRiver H320&lt;/A&gt; I wanted to sync meta data from WMP to the iRiver so that I could browse by artist and album. Well the problem is that there are all these scary interfaces (like IWMHeaderInfo, IWMHeaderInfo2 and IWMHeaderInfo3)&amp;nbsp;&amp;nbsp;and to figure out how to extract meta data for DRM'ed files took me a few hours (just to find the right interface). Then it felt like screen scraping to actually get the tags (Artist, Album etc) from the files themselves.&lt;/P&gt;
&lt;P&gt;It's great that Apple is exposing a decent COM Interop library from iTunes that in turn exposes a nice managed interface in .NET, but geez... I should not have to wait for Longhorn to do the same thing on my PC.&lt;/P&gt;
&lt;P&gt;BTW - if you have an iRiver H320&amp;nbsp;and want to get the meta data from WMP, the version of &lt;A href="http://tdt.sourceforge.net/"&gt;TDT&lt;/A&gt; that I built can be found &lt;A href="http://www.shahine.com/software/TDT_Source.zip"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=77681e1f-d742-480e-94bd-5c4cd87dff90"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=274411" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item><item><title>.NET Compact Framework Essentials</title><link>http://blogs.msdn.com/omars/archive/2004/09/19/231464.aspx</link><pubDate>Mon, 20 Sep 2004 02:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:231464</guid><dc:creator>omars</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/omars/comments/231464.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=231464</wfw:commentRss><description>&lt;P&gt;One very frustrating thing about programming with the .NET Compact Framework is that it's quite limited in how much integration capabilities you have with the device. It's very good if you build a little application that doesn't need to hook into the device, or hook into Outlook, but as soon as you want to do something like that you have to use p/invoke which involves hunting down the signatures, and testing code that I don't really understand. Luckily &lt;A href="http://www.pinvoke.net/"&gt;p/invoke.net&lt;/A&gt; has many of them already.&lt;/P&gt;
&lt;P&gt;However, there are two really good options that I recently discovered.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.opennetcf.org/"&gt;&lt;STRONG&gt;OpenNETCF.org&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This set of .NET assemblies helps you overcome a plethora of shortcomings of the compact framework. The folks who developed this did an amazing job providing excellent functionality to .NET developers. Some of my favorites namespaces are &lt;A href="http://www.opennetcf.org/library/OpenNETCF.Win32.html"&gt;OpenNETCF.Win32&lt;/A&gt; which wraps most of the p/invoke functions you'll need as well as &lt;A href="http://www.opennetcf.org/library/OpenNETCF.Windows.Forms.html"&gt;OpenNETCF.Windows.Forms&lt;/A&gt; which provides some very nice Controls that .NET doesn't provide like Groupbox, NotifyIcon, Battery indicators and so on.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.inthehand.com/index.php?page=6&amp;amp;show=1,2"&gt;&lt;STRONG&gt;PocketOutlook In The Hand&lt;/STRONG&gt;&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This is a superb managed Outlook Object model. Today, it's impossible to talk to Outlook on a Pocket PC using p/invoke because the framework does not allow you to call COM objects. The object model is mostly identical to the OM of it's big brother, Outlook XP/2003.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://samgentile.com/blog/archive/2004/05/12/11523.aspx"&gt;I hear &lt;/A&gt;that 2.0 of the framework allows you to call COM objects, but until then, avoid writing C code and head on over to InTheHand to get &lt;A href="http://www.inthehand.com/index.php?page=6&amp;amp;show=1,2"&gt;Pocket Outlook&lt;/A&gt;. It's not free, but there is a trial you can play with, and it's priced modestly. One caveat though. You need to be very careful and make sure to dispose all your objects. I didn't do this and ended up with a very sad Pocket PC after running my app for a few hours.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=e501c6c6-2d2f-4240-9dc8-fbfe1a91e0c2"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=231464" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item><item><title>System.Drawing.Imaging performance fix in .NET 1.1 SP1</title><link>http://blogs.msdn.com/omars/archive/2004/09/01/224108.aspx</link><pubDate>Thu, 02 Sep 2004 01:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:224108</guid><dc:creator>omars</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/omars/comments/224108.aspx</comments><wfw:commentRss>http://blogs.msdn.com/omars/commentrss.aspx?PostID=224108</wfw:commentRss><description>&lt;P&gt;A few months ago I encountered a &lt;A href="http://www.shahine.com/omar/PermaLink,guid,673c131f-26db-4f44-9908-c2667da832ad.aspx"&gt;significant performance problem with System.Drawing.Imaging&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;I found that by using the new Method performance was 93x faster (on average) for loading jpegs.&lt;/P&gt;
&lt;P&gt;You can download the update here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=a8f5654f-088e-40b2-bbdb-a83353618b38&amp;amp;DisplayLang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=a8f5654f-088e-40b2-bbdb-a83353618b38&amp;amp;DisplayLang=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Specifically, this update adds a new method to &lt;SPAN class=searchword&gt;System.Drawing.Imaging&lt;/SPAN&gt;:&lt;/P&gt;
&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;System.Drawing.Image.FromStream(Stream stream, &lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;bool&lt;/SPAN&gt; useICM, &lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;bool&lt;/SPAN&gt; validateImageData)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;This is essentially a new signature for an existing method:&lt;/P&gt;
&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;System.Drawing.Image.FromStream(Stream stream, &lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;bool&lt;/SPAN&gt; useICM)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;As you can see, &lt;FONT style="FONT-SIZE: 9pt" face="Courier New"&gt;validateImageData&lt;/FONT&gt; is a new parameter. Setting it to true is the default behavior that we have today (essentially the same as calling &lt;FONT face="Courier New"&gt;&lt;SPAN style="FONT-SIZE: 9pt"&gt;FromStream(Stream stream, &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;bool&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt"&gt; useICM)&lt;/SPAN&gt;&lt;/FONT&gt;).&lt;/P&gt;
&lt;P&gt;So I made a change to my application. Before my code looked like this:&lt;/P&gt;
&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;using&lt;/SPAN&gt; (Image photo &lt;SPAN style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;=&lt;/SPAN&gt; Image.FromFile(&lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;this&lt;/SPAN&gt;.fileInfo.FullName, &lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;true&lt;/SPAN&gt;))
{
    &lt;SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;//do stuff
&lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;So I changed it to:&lt;/P&gt;
&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;using&lt;/SPAN&gt; (FileStream fs &lt;SPAN style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;new&lt;/SPAN&gt; FileStream(&lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;this&lt;/SPAN&gt;.fileInfo.FullName, FileMode.Open, FileAccess.ReadWrite))
{
&lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;&lt;FONT color=#003300&gt;    &lt;/FONT&gt;using&lt;/SPAN&gt; (Image photo &lt;SPAN style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;=&lt;/SPAN&gt; Image.FromStream(fs, &lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;true&lt;/SPAN&gt;, &lt;SPAN style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;false&lt;/SPAN&gt;))
    {
        &lt;SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: white"&gt;// do stuff
&lt;/SPAN&gt;    }
}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;img width="0" height="0" src="http://www.shahine.com/omar/cptrk.ashx?id=dcb28d18-5284-434a-a641-cd9917b72be2"&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=224108" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/omars/archive/tags/Programming/default.aspx">Programming</category></item></channel></rss>