<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: IDisposable, Done Right</title>
	<atom:link href="http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/</link>
	<description>Just another LosTechies site</description>
	<lastBuildDate>Mon, 06 May 2013 07:30:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Jonathan C Dickinson</title>
		<link>http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/#comment-202</link>
		<dc:creator>Jonathan C Dickinson</dc:creator>
		<pubDate>Tue, 22 Jan 2013 08:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/chrispatterson/?p=103#comment-202</guid>
		<description>Did you read the comment?

Firstly, if your library is being consumed by a 3rd party you can&#039;t guarantee that your best practices are being adhered to. There are bad programmers out there.
If your library is not being consumed by a 3rd party you can&#039;t guarantee that your best practices are being adhered to, especially in threaded situations. Good programmers make mistakes.Throwing an ObjectDisposedException is better than double-disposing in absolutely every situation. Rolled back that transaction twice? &quot;Yeah, but the controlling thread was in charge of disposing that object.&quot; Try telling that to a customer who just lost millions to a bug that is easily avoided by simply not using a `bool`. At the very least it&#039;s a lot more explanatory than a FileNotFoundException in a bug report.I don&#039;t put hypothetical walls up around myself, I put up real barriers - and you are irresponsible if you don&#039;t because there is a massive difference between what you should do and what could happen.</description>
		<content:encoded><![CDATA[<p>Did you read the comment?</p>
<p>Firstly, if your library is being consumed by a 3rd party you can&#8217;t guarantee that your best practices are being adhered to. There are bad programmers out there.<br />
If your library is not being consumed by a 3rd party you can&#8217;t guarantee that your best practices are being adhered to, especially in threaded situations. Good programmers make mistakes.Throwing an ObjectDisposedException is better than double-disposing in absolutely every situation. Rolled back that transaction twice? &#8220;Yeah, but the controlling thread was in charge of disposing that object.&#8221; Try telling that to a customer who just lost millions to a bug that is easily avoided by simply not using a `bool`. At the very least it&#8217;s a lot more explanatory than a FileNotFoundException in a bug report.I don&#8217;t put hypothetical walls up around myself, I put up real barriers &#8211; and you are irresponsible if you don&#8217;t because there is a massive difference between what you should do and what could happen.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kamranayub</title>
		<link>http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/#comment-201</link>
		<dc:creator>kamranayub</dc:creator>
		<pubDate>Thu, 27 Dec 2012 17:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/chrispatterson/?p=103#comment-201</guid>
		<description>This is important, and this is a great tip! When I pulled down the latest ActionMailer.Net library from Nuget, I started getting StackOverflowExceptions. Turns out, they didn&#039;t implement IDisposable correctly. I created a pull-request that fixes the issue, but in retrospect, I still missed some tips brought up in this article.

Thanks for sharing.</description>
		<content:encoded><![CDATA[<p>This is important, and this is a great tip! When I pulled down the latest ActionMailer.Net library from Nuget, I started getting StackOverflowExceptions. Turns out, they didn&#8217;t implement IDisposable correctly. I created a pull-request that fixes the issue, but in retrospect, I still missed some tips brought up in this article.</p>
<p>Thanks for sharing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shmueli Englard</title>
		<link>http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/#comment-200</link>
		<dc:creator>Shmueli Englard</dc:creator>
		<pubDate>Wed, 26 Dec 2012 20:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/chrispatterson/?p=103#comment-200</guid>
		<description>What do you think of http://dave-black.blogspot.com/2011/03/how-do-you-properly-implement.html? I&#039;ve been using it as my template</description>
		<content:encoded><![CDATA[<p>What do you think of <a href="http://dave-black.blogspot.com/2011/03/how-do-you-properly-implement.html" rel="nofollow">http://dave-black.blogspot.com/2011/03/how-do-you-properly-implement.html</a>? I&#8217;ve been using it as my template</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Lindell</title>
		<link>http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/#comment-197</link>
		<dc:creator>Mark Lindell</dc:creator>
		<pubDate>Wed, 05 Dec 2012 16:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/chrispatterson/?p=103#comment-197</guid>
		<description>That&#039;s awesome... hey, wait a minute...</description>
		<content:encoded><![CDATA[<p>That&#8217;s awesome&#8230; hey, wait a minute&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MasaSam</title>
		<link>http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/#comment-196</link>
		<dc:creator>MasaSam</dc:creator>
		<pubDate>Tue, 04 Dec 2012 18:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/chrispatterson/?p=103#comment-196</guid>
		<description>Good article. Only thing I&#039;ve noticed to other dispose advice articles I have read is that the sample implementation here sets the private _disposed field to true when disposing has done. Some other articles advices to set, and what I usually do, to set the field true right after it is checked in the beginning of protected Dispose method to prevent entering the disposing lines twice. </description>
		<content:encoded><![CDATA[<p>Good article. Only thing I&#8217;ve noticed to other dispose advice articles I have read is that the sample implementation here sets the private _disposed field to true when disposing has done. Some other articles advices to set, and what I usually do, to set the field true right after it is checked in the beginning of protected Dispose method to prevent entering the disposing lines twice. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RaptorXP</title>
		<link>http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/#comment-195</link>
		<dc:creator>RaptorXP</dc:creator>
		<pubDate>Tue, 04 Dec 2012 15:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/chrispatterson/?p=103#comment-195</guid>
		<description>Hmm yeah, I agree with previous comments. The suggestion in this post is only valid when you want to dispose of unmanaged resources. I can tell you that in 6 years working with .NET, I *NEVER* had to deal with unmanaged resources from .NET.

It is actually harmful to follow this recommendation if you don&#039;t have unmanaged resources because implementing a finalizer in a class automatically promotes the object to Gen 2, and you&#039;ll end up with poor GC performance.</description>
		<content:encoded><![CDATA[<p>Hmm yeah, I agree with previous comments. The suggestion in this post is only valid when you want to dispose of unmanaged resources. I can tell you that in 6 years working with .NET, I *NEVER* had to deal with unmanaged resources from .NET.</p>
<p>It is actually harmful to follow this recommendation if you don&#8217;t have unmanaged resources because implementing a finalizer in a class automatically promotes the object to Gen 2, and you&#8217;ll end up with poor GC performance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Patterson</title>
		<link>http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/#comment-194</link>
		<dc:creator>Chris Patterson</dc:creator>
		<pubDate>Tue, 04 Dec 2012 14:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/chrispatterson/?p=103#comment-194</guid>
		<description>If you are using any third-party library (including most of the .NET runtime, such as WCF and others) there no way you can achieve this &quot;catch-free&quot; system. If there is nothing the calling method can do about the exception (other than explode in a spectacular fashion) - why bother throwing the exception. Sometimes, RPC calls and the like just don&#039;t end in a happy place, and that&#039;s often just fine. Not to mention that so many people call Dispose in a catch block or finally block, without a try/catch around it, which can lead to entire application crashes.

Which sucks at 2am in a production 24x7 system. Plan for failure, and deal with it in the code so you can sleep at night.</description>
		<content:encoded><![CDATA[<p>If you are using any third-party library (including most of the .NET runtime, such as WCF and others) there no way you can achieve this &#8220;catch-free&#8221; system. If there is nothing the calling method can do about the exception (other than explode in a spectacular fashion) &#8211; why bother throwing the exception. Sometimes, RPC calls and the like just don&#8217;t end in a happy place, and that&#8217;s often just fine. Not to mention that so many people call Dispose in a catch block or finally block, without a try/catch around it, which can lead to entire application crashes.</p>
<p>Which sucks at 2am in a production 24&#215;7 system. Plan for failure, and deal with it in the code so you can sleep at night.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Patterson</title>
		<link>http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/#comment-193</link>
		<dc:creator>Chris Patterson</dc:creator>
		<pubDate>Tue, 04 Dec 2012 14:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/chrispatterson/?p=103#comment-193</guid>
		<description>If multiple threads are sharing a disposable resource, a parent or other thread should be responsible for disposing of it once the consuming threads have exited. Otherwise, a thread could dispose of something that another thread might still be using.</description>
		<content:encoded><![CDATA[<p>If multiple threads are sharing a disposable resource, a parent or other thread should be responsible for disposing of it once the consuming threads have exited. Otherwise, a thread could dispose of something that another thread might still be using.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Patterson</title>
		<link>http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/#comment-192</link>
		<dc:creator>Chris Patterson</dc:creator>
		<pubDate>Tue, 04 Dec 2012 14:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/chrispatterson/?p=103#comment-192</guid>
		<description>Both classes have their own private _disposed, so no problem there.</description>
		<content:encoded><![CDATA[<p>Both classes have their own private _disposed, so no problem there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fflams</title>
		<link>http://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/#comment-191</link>
		<dc:creator>fflams</dc:creator>
		<pubDate>Tue, 04 Dec 2012 11:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/chrispatterson/?p=103#comment-191</guid>
		<description>This is a good article for beginner developpers, however you should check your example.
When explaining how a derived class should override the Dispose(bool) method, you have it set the _disposed falg to true before calling the base.Dispose, that will result in the base class not doing its dispose job and simply setting object references to null....</description>
		<content:encoded><![CDATA[<p>This is a good article for beginner developpers, however you should check your example.<br />
When explaining how a derived class should override the Dispose(bool) method, you have it set the _disposed falg to true before calling the base.Dispose, that will result in the base class not doing its dispose job and simply setting object references to null&#8230;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
