﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on Why does RemoteDatabsaeChanges has DisposeAsync, and other pro dev tips</title><description>Ken,
This code:
	var sw = Stopwatch.StartNew();
	for (int i = 0; i &lt; 1000 * 1000; i++)
	{
		var tcs = new TaskCompletionSource&lt;object&gt;();
		tcs.SetResult(null);
	}
	Console.WriteLine(sw.ElapsedMilliseconds);


Completes in less than 150 ms, so I think that we are good on that regard.

As for anyhow anywhen for the error, no. But I am pretty sure that there is a test that will catch it if it will happen.</description><link>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment7</link><guid>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment7</guid><pubDate>Thu, 02 Aug 2012 18:21:51 GMT</pubDate></item><item><title>Ken Egozi commented on Why does RemoteDatabsaeChanges has DisposeAsync, and other pro dev tips</title><description>Without looking at your code, I'd guess that CompletedTask will generate a TaskCompletionSource and set its value.
A new TaskCompletionSource() is hardly equivalent to new object().
A Task Completion Source etc is hardly a simple object(). who knows what it is doing internally during the construction of the tcs.

e.g. Brad Wilson on http://bradwilson.typepad.com/blog/2012/04/tpl-and-servers-pt4.html

talks about the cost for TCS creations, and advocates re-using cached versions for Completed (and Cancelled) tasks


as for 2) are you absolutely certain that no-when in the future you'll be null-ing a value in that dictionary for some reason, causing a failure here that no test will catch? Dispose calls should be as safe as possible, especially in a highly concurrent server env. </description><link>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment6</link><guid>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment6</guid><pubDate>Thu, 02 Aug 2012 17:43:37 GMT</pubDate></item><item><title>Ayende Rahien commented on Why does RemoteDatabsaeChanges has DisposeAsync, and other pro dev tips</title><description>Ken,

1) The cost of new object() is minimal.

2) No, the value is never null.</description><link>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment5</link><guid>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment5</guid><pubDate>Thu, 02 Aug 2012 17:31:04 GMT</pubDate></item><item><title>Ken Egozi commented on Why does RemoteDatabsaeChanges has DisposeAsync, and other pro dev tips</title><description>I really like the "making live services more debuggable" series you are running.

a couple of things though:
1. why new CompletedTask all the time? since all CompletedTasks are essentially the same you could be able to have a CompletedTask.Instance or something of sorts, if you're doing that a lot.
2. are you 100% sure that keyValuePair.Value will never be null there? connections might leak in that (perhaps remote) case</description><link>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment4</link><guid>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment4</guid><pubDate>Thu, 02 Aug 2012 16:46:32 GMT</pubDate></item><item><title>Ayende Rahien commented on Why does RemoteDatabsaeChanges has DisposeAsync, and other pro dev tips</title><description>Chadbr,
We are handling this.</description><link>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment3</link><guid>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment3</guid><pubDate>Thu, 02 Aug 2012 12:56:46 GMT</pubDate></item><item><title>chadbr commented on Why does RemoteDatabsaeChanges has DisposeAsync, and other pro dev tips</title><description>Wouldn't the application throw an exception if this runs when the app is closing down?</description><link>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment2</link><guid>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment2</guid><pubDate>Thu, 02 Aug 2012 12:54:54 GMT</pubDate></item><item><title>Moti commented on Why does RemoteDatabsaeChanges has DisposeAsync, and other pro dev tips</title><description>DDD - Debug Driven Design</description><link>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment1</link><guid>http://ayende.com/157345/why-does-remotedatabsaechanges-has-disposeasync-and-other-pro-dev-tips#comment1</guid><pubDate>Thu, 02 Aug 2012 10:14:30 GMT</pubDate></item></channel></rss>