<?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: Forcing Event Consumer Cleanup without Weak Events</title>
	<atom:link href="http://www.scottlogic.co.uk/blog/colin/2010/02/forcing-event-consumer-cleanup-without-weak-events/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scottlogic.co.uk/blog/colin/2010/02/forcing-event-consumer-cleanup-without-weak-events/</link>
	<description>Colin Eberhardt&#039;s Adventures in WPF</description>
	<lastBuildDate>Wed, 08 Sep 2010 07:10:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Michael</title>
		<link>http://www.scottlogic.co.uk/blog/colin/2010/02/forcing-event-consumer-cleanup-without-weak-events/#comment-17587</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Thu, 19 Aug 2010 15:02:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.scottlogic.co.uk/blog/colin/?p=568#comment-17587</guid>
		<description>&quot;This does not cause significant problems if the listener has a shorter or the same lifecycle that the source, as is the case where you add event handlers for controls in a Windows Form for example.&quot;

This sentence is backwards. There are not problems if the *source* has a shorter or equal lifetime as the *listener*, because it is the source which is preventing the listener from being collected.</description>
		<content:encoded><![CDATA[<p>&#8220;This does not cause significant problems if the listener has a shorter or the same lifecycle that the source, as is the case where you add event handlers for controls in a Windows Form for example.&#8221;</p>
<p>This sentence is backwards. There are not problems if the *source* has a shorter or equal lifetime as the *listener*, because it is the source which is preventing the listener from being collected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Eberhardt</title>
		<link>http://www.scottlogic.co.uk/blog/colin/2010/02/forcing-event-consumer-cleanup-without-weak-events/#comment-17574</link>
		<dc:creator>Colin Eberhardt</dc:creator>
		<pubDate>Thu, 19 Aug 2010 09:48:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.scottlogic.co.uk/blog/colin/?p=568#comment-17574</guid>
		<description>@Ashley,

Which one are not working for you? If you let me know I can fix them :-)

Colin E.</description>
		<content:encoded><![CDATA[<p>@Ashley,</p>
<p>Which one are not working for you? If you let me know I can fix them <img src='http://www.scottlogic.co.uk/blog/colin/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Colin E.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashley Marmolejo</title>
		<link>http://www.scottlogic.co.uk/blog/colin/2010/02/forcing-event-consumer-cleanup-without-weak-events/#comment-17480</link>
		<dc:creator>Ashley Marmolejo</dc:creator>
		<pubDate>Tue, 17 Aug 2010 16:10:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.scottlogic.co.uk/blog/colin/?p=568#comment-17480</guid>
		<description>Some of your links don&#039;t seem to work.</description>
		<content:encoded><![CDATA[<p>Some of your links don&#8217;t seem to work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach Saw</title>
		<link>http://www.scottlogic.co.uk/blog/colin/2010/02/forcing-event-consumer-cleanup-without-weak-events/#comment-9378</link>
		<dc:creator>Zach Saw</dc:creator>
		<pubDate>Tue, 16 Mar 2010 01:16:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.scottlogic.co.uk/blog/colin/?p=568#comment-9378</guid>
		<description>Let me clarify this, &quot;It’s easy to make a strong ref to an object from a weaf-ref, whereas an implicit strong ref makes it hard to break&quot;

I meant it&#039;s easy making strong ref from weak ref but not the other way around.</description>
		<content:encoded><![CDATA[<p>Let me clarify this, &#8220;It’s easy to make a strong ref to an object from a weaf-ref, whereas an implicit strong ref makes it hard to break&#8221;</p>
<p>I meant it&#8217;s easy making strong ref from weak ref but not the other way around.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach Saw</title>
		<link>http://www.scottlogic.co.uk/blog/colin/2010/02/forcing-event-consumer-cleanup-without-weak-events/#comment-9377</link>
		<dc:creator>Zach Saw</dc:creator>
		<pubDate>Tue, 16 Mar 2010 01:13:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.scottlogic.co.uk/blog/colin/?p=568#comment-9377</guid>
		<description>Thanks for clarifying what you meant by &#039;dead&#039;. Reading your post, the impression I got was that you meant the object is dead in the sense of getting GC&#039;ed.

This brings me to another point.

This unpredictability is inherent to everything that uses weakref - such as Threading.Timer. Once &#039;dead&#039; (as per your definition), the timer event may still fire a few times before it gets GC&#039;ed, thus introducing unpredictability. That simply means you need to care about its lifetime and dispose it when you want it to stop. Same principle applies to weak events, you&#039;d still care about its lifetime and remove the event handlers at the correct point. For consistency, I&#039;d prefer all events be changed to weak events by default (should have been this way from the get-go). It&#039;s easy to make a strong ref to an object from a weaf-ref, whereas an implicit strong ref makes it hard to break (in fact, it&#039;ll be impossible if the event is in a third-party library where you wouldn&#039;t want to change the source / haven&#039;t got the source). The overhead to assign and call a weak event if supported natively is negligible. And with events being weak by default, developers are forced to think about the object, as opposed to the method they want triggered, when they hook it to the event.</description>
		<content:encoded><![CDATA[<p>Thanks for clarifying what you meant by &#8216;dead&#8217;. Reading your post, the impression I got was that you meant the object is dead in the sense of getting GC&#8217;ed.</p>
<p>This brings me to another point.</p>
<p>This unpredictability is inherent to everything that uses weakref &#8211; such as Threading.Timer. Once &#8216;dead&#8217; (as per your definition), the timer event may still fire a few times before it gets GC&#8217;ed, thus introducing unpredictability. That simply means you need to care about its lifetime and dispose it when you want it to stop. Same principle applies to weak events, you&#8217;d still care about its lifetime and remove the event handlers at the correct point. For consistency, I&#8217;d prefer all events be changed to weak events by default (should have been this way from the get-go). It&#8217;s easy to make a strong ref to an object from a weaf-ref, whereas an implicit strong ref makes it hard to break (in fact, it&#8217;ll be impossible if the event is in a third-party library where you wouldn&#8217;t want to change the source / haven&#8217;t got the source). The overhead to assign and call a weak event if supported natively is negligible. And with events being weak by default, developers are forced to think about the object, as opposed to the method they want triggered, when they hook it to the event.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
