﻿<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://developers.de/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>Is ADO.NET 2.0 reliable?</title><link />http://developers.de/blogs/damir_dobric/archive/2007/07/18/is-ado-net-2-0-reliable.aspx<description>I know that this question is a little bit provocative, but if you are interested in philosophy of ADO.NET and reliability at all, this post is right for you. In last few weeks, I found some very strange behavior in one ASP.NET 2.0 application. Long time</description><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>re: Is ADO.NET 2.0 reliable?</title><link />http://developers.de/blogs/damir_dobric/archive/2007/07/18/is-ado-net-2-0-reliable.aspx#221079<pubdate>Fri, 22 Apr 2011 14:14:43 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:221079</guid><dc:creator>developers.de</dc:creator><description>&lt;p&gt;Is ado net 2 0 reliable.. OMG! :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=221079" width="1" height="1"&gt;</description></item><item><title>re: Is ADO.NET 2.0 reliable?</title><link />http://developers.de/blogs/damir_dobric/archive/2007/07/18/is-ado-net-2-0-reliable.aspx#1613<pubdate>Fri, 19 Oct 2007 22:08:10 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:1613</guid><dc:creator>Damir Dobric</dc:creator><description>&lt;p&gt;Thanks for your comment Eduardo. However some people think this would be a &amp;quot;feature by design&amp;quot; :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=1613" width="1" height="1"&gt;</description></item><item><title>re: Is ADO.NET 2.0 reliable?</title><link />http://developers.de/blogs/damir_dobric/archive/2007/07/18/is-ado-net-2-0-reliable.aspx#1608<pubdate>Fri, 19 Oct 2007 19:31:07 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:1608</guid><dc:creator>Eduardo</dc:creator><description>&lt;p&gt;The bug must be in the Data Provider's connection pool. Probably the reader in C2 is reading data from Test3 connection.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=1608" width="1" height="1"&gt;</description></item><item><title>rely and reliability</title><link />http://developers.de/blogs/damir_dobric/archive/2007/07/18/is-ado-net-2-0-reliable.aspx#1502<pubdate>Mon, 20 Aug 2007 14:35:14 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:1502</guid><dc:creator>Same Old Applications</dc:creator><description>&lt;p&gt;Damir Dobrić post interesting article (&amp;amp;quot;Is ADO.NET reliable&amp;amp;quot;) on his blog about unexpected&lt;/p&gt;
&lt;img src="http://developers.de/aggbug.aspx?PostID=1502" width="1" height="1"&gt;</description></item><item><title>re: Is ADO.NET 2.0 reliable?</title><link />http://developers.de/blogs/damir_dobric/archive/2007/07/18/is-ado-net-2-0-reliable.aspx#1501<pubdate>Mon, 20 Aug 2007 12:05:55 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:1501</guid><dc:creator>D.Adamec</dc:creator><description>&lt;p&gt;I think Damir wrote this sample as a small simplification that reproduces a problem hiding &amp;nbsp;in a code deep under some DAL classes that follows usual design-paterns and guides for accessing data. &amp;nbsp;And combination of &amp;nbsp;factory and ADO.NET classes in multithreaded environment &amp;nbsp;leads to the point where one query gets result from another query. The point is that the flawed code is here just to show us this behavior and it seems that the switching connection can jump out even when the code would be written better.&lt;/p&gt;
&lt;p&gt;What this sample made me think of is: we all use a lot of built-in classes from many sources (core, WPF, WWF, WCF, factories, guidance packs, app blocks etc.), market push us to adopt more and more, quicker and quicker and the truth is: we should be very careful combining those bright new shiny things and putting them into our systems. For example, the book says: “Windows Workflow Foundation managing the multithreading for you so you can think of the business side of your application“. &amp;nbsp;Great tip  . And of course if we combine WWF with my DAL from Ent. App block and some other XYZ new technology and put it /of course/ in a web application… we should know what we are doing ;-) … and we want to be sure that the query one will get the results of query one.&lt;/p&gt;
&lt;p&gt;The mixture of connections &amp;nbsp;from the Damir’s sample should somehow be marked at least.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=1501" width="1" height="1"&gt;</description></item><item><title>re: Is ADO.NET 2.0 reliable?</title><link />http://developers.de/blogs/damir_dobric/archive/2007/07/18/is-ado-net-2-0-reliable.aspx#1500<pubdate>Mon, 20 Aug 2007 09:28:19 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:1500</guid><dc:creator>Miha Markic</dc:creator><description>&lt;p&gt;Hi Damir,&lt;/p&gt;
&lt;p&gt;I think you are wrong in your assumptions. Test1 and Test2 are not thread safe because of the way connection pooling works. When you create a new instance of SqlConnection and open it you are not getting a new *physicall* connection unless pooled ones are in use. It is quite possible that your test methods all hand around a common *physicall* connection or something like that. Also take note, that when you create a multithreading mess the results aren't ones you would expect - a problem causes by inproper multithreading might corrupt whoknows which part of your application.&lt;/p&gt;
&lt;p&gt;And BTW, my name is Miha :-)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=1500" width="1" height="1"&gt;</description></item><item><title>re: Is ADO.NET 2.0 reliable?</title><link />http://developers.de/blogs/damir_dobric/archive/2007/07/18/is-ado-net-2-0-reliable.aspx#1499<pubdate>Mon, 20 Aug 2007 09:10:00 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:1499</guid><dc:creator>Damir Dobric</dc:creator><description>&lt;p&gt;Thanks for your comment Micha. You are right, that nobody should create such mess. However there is one thing which is a little different than you write. &amp;nbsp;That is, the Threads inTest1 and Test2 are thread-safe. If they are safe, why do they not work as expected? &lt;/p&gt;
&lt;p&gt;Developers who implemented Test1 and Test2 have nothing to do with developers who implemented buggy Test3. Test1 and Test2 were implemented in one assembly and Test3 in another one. The bad code in Test3 in reality does not look as shown in this post. This post is huge simplification of the problem.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=1499" width="1" height="1"&gt;</description></item><item><title>re: Is ADO.NET 2.0 reliable?</title><link />http://developers.de/blogs/damir_dobric/archive/2007/07/18/is-ado-net-2-0-reliable.aspx#1498<pubdate>Mon, 20 Aug 2007 08:06:01 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:1498</guid><dc:creator>Miha Markic</dc:creator><description>&lt;p&gt;Man, your example if flawed in the beggining. You are abusing multithreading where classes used are *not* multithread safe. You are basically screwing a connection which might be reused from other threads. But what do you expect from such mutlthread bugs? Mutlithreading bugs are always hard to diagnose and might appear seemingly unrelated to the point where the error really happens.&lt;/p&gt;
&lt;p&gt;To sum it up: your code is flawed (as you know) and expecting meaningfull errors from multithreading errors is very very optimistic.&lt;/p&gt;
&lt;p&gt;Instead of prooving that ado.net doesn't work, you should educate the developer that created such a mess ;-)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=1498" width="1" height="1"&gt;</description></item></channel></rss>