<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Debugging</title>
        <link>http://ayende.com/Blog/category/503.aspx</link>
        <description>Debugging</description>
        <language>en-US</language>
        <copyright>Ayende Rahien</copyright>
        <managingEditor>Ayende@ayende.com</managingEditor>
        <generator>Subtext Version 1.9.3.51</generator>
        <item>
            <title>How do you track that?</title>
            <link>http://ayende.com/Blog/archive/2008/05/05/How-do-you-track-that.aspx</link>
            <description>&lt;p&gt;I have an interesting problem with SvnBridge.&lt;/p&gt;
&lt;p&gt;After around 5000 full revision request (a set of requests that can occur), the application get hung making a web service call to TFS. This comes after making quite a few calls to TFS, and is generally fairly easily reproducible. The actual call being made is not an expensive one (nor is it the same call). TFS is responsive during that time, so it is not its fault.&lt;/p&gt;
&lt;p&gt;It looks very much like I am hitting the 2 concurrent HTTP requests, except that all requests are serialized, and there is no multi threaded work involved.&lt;/p&gt;
&lt;p&gt;I have been unable to reproduce this under a profiler or debugger...&lt;/p&gt;
&lt;p&gt;Thoughts?&lt;/p&gt;
&lt;img src="http://ayende.com/Blog/aggbug/10209.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ayende Rahien</dc:creator>
            <guid>http://ayende.com/Blog/archive/2008/05/05/How-do-you-track-that.aspx</guid>
            <pubDate>Mon, 05 May 2008 08:09:12 GMT</pubDate>
            <wfw:comment>http://ayende.com/Blog/comments/10209.aspx</wfw:comment>
            <comments>http://ayende.com/Blog/archive/2008/05/05/How-do-you-track-that.aspx#feedback</comments>
            <slash:comments>9</slash:comments>
            <wfw:commentRss>http://ayende.com/Blog/comments/commentRss/10209.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Continuous Environment Validation</title>
            <link>http://ayende.com/Blog/archive/2008/02/27/Continuous-Environment-Validation.aspx</link>
            <description>&lt;p&gt;For some reason, it seems like I am talking about &lt;a href="http://www.pragprog.com/titles/mnee"&gt;Release It&lt;/a&gt; a lot lately, to a lot of people. As I said when I reviewed it, that book literally changed the way that I approach problems. It also made me much more aware of the failure scenarios that I need to deal with.&lt;/p&gt;  &lt;p&gt;A while ago I sat down in one of &lt;a href="http://codebetter.com/blogs/jeremy.miller/"&gt;Jeremy Miller&lt;/a&gt;'s talks and he mentioned that he had added the ability to do Environment Validation to StructureMap, so when the application is starting up, it can verify that all its dependencies are in a valid state. That made so much sense to me that I immediately &lt;a href="http://ayende.com/Blog/archive/2007/11/29/Envrionment-Validation-and-Windsor-Extensibility.aspx"&gt;added this facility&lt;/a&gt; to Windsor. &lt;/p&gt;  &lt;p&gt;What I am going to talk about today is to take this approach one step further. Instead of running those tests just at application startup, they should be run every day, or every hour.&lt;/p&gt;  &lt;p&gt;Yes, the operation team is suppose to have monitoring on the application, but unless they were part of the development process (or are a dedicated ops team), that still leaves you as the principal owner of knowledge in about the environment your application need. Even if you have a capable operation team, and they have very good understanding on your application, it is often best to support them by providing this functionality. It is very likely that you can get more information from your application that the operation team.&lt;/p&gt;  &lt;p&gt;And if you don't have an operation team, you &lt;em&gt;really&lt;/em&gt; want to be able to do that.&lt;/p&gt;  &lt;p&gt;Now that we have taken care of the motivation for this approach, let us see what exactly we are talking about.&lt;/p&gt;  &lt;p&gt;Environment validation means that you validate the your entire environment is in a state that allows your application to run in full capacity. I am going to list a few things that I think are essential for many applications, I am sure that I am going to miss some, however, feel free to add more items to the list.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Certificate's valid and expire in more than a month.&lt;/li&gt;    &lt;li&gt;Domain registration expires in than one month.&lt;/li&gt;    &lt;li&gt;For each server in the application (web, database, cache, application):&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Server is alive and responding (within specified time).&lt;/li&gt;      &lt;li&gt;Server's HD has more than 10% free space.&lt;/li&gt;      &lt;li&gt;Server CPU usage is less than 80%&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Associated 3rd party servers are responding within their SLA.&lt;/li&gt;    &lt;li&gt;Sample execution of common scenarios finish successfully in a specified time frame.&lt;/li&gt;    &lt;li&gt;Number of faults (non critical ones) in the application is below the threshold.&lt;/li&gt;    &lt;li&gt;No critical fault (critical defined as taking the entire system down).&lt;/li&gt;    &lt;li&gt;Current traffic / work on the system is within expected range (too low, and we may have external network issue, too high, and we need to up our capacity).&lt;/li&gt;    &lt;li&gt;Application audit trail is updated. (Can do the same for log, if required).&lt;/li&gt;    &lt;li&gt;System backup was performed and completed successfully.&lt;/li&gt;    &lt;li&gt;All batch jobs have been run and completed successfully.&lt;/li&gt;    &lt;li&gt;Verify the previously generated faults has been dealt with.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Those are the generalities, I am pretty sure that you can think of a lot more that fit your own systems.&lt;/p&gt;  &lt;p&gt;The important thing to remember here is that you should treat this piece as a core part of the application infrastructure. In many production environment, you simply cannot get access. This is part of the application, and should be deployed with the application. At any rate, it should be made clear that this is part of the deployment program, not just useless appendix.&lt;/p&gt;  &lt;p&gt;My preference would be to have a windows service to monitor my systems and alert when there are failures. &lt;/p&gt;  &lt;p&gt;This is another important consideration, how do you send alerts? And when? You should have at least three levels of warnings: Warning, Error and Fatal. You send them according to the severity of the problem.&lt;/p&gt;  &lt;p&gt;In all cases, I would log them to the event log at a minimum, probably send mail as well. For Error and Fatal levels, I would use SMS / generate alert to operation monitoring systems. If there &lt;em&gt;are&lt;/em&gt; monitoring system in place that the operations team is using, it is best to route things through them. They probably have the ability to wake someone up in 3 AM already. If you don't have that, than an SMS is at least near instantaneous, and you can more or less rely on that to be read.&lt;/p&gt;  &lt;p&gt;That is long enough, and I have to do some work today, so I'll just stop here, I think.&lt;/p&gt;&lt;img src="http://ayende.com/Blog/aggbug/10074.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ayende Rahien</dc:creator>
            <guid>http://ayende.com/Blog/archive/2008/02/27/Continuous-Environment-Validation.aspx</guid>
            <pubDate>Wed, 27 Feb 2008 16:07:45 GMT</pubDate>
            <comments>http://ayende.com/Blog/archive/2008/02/27/Continuous-Environment-Validation.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://ayende.com/Blog/comments/commentRss/10074.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Exception handling best practices</title>
            <link>http://ayende.com/Blog/archive/2007/12/06/Exception-handling-best-practices.aspx</link>
            <description>&lt;p&gt;No, I am not going to tell you to use throw; instead of throw e; I am going to talk about exception messages, assumptions, and pain.&lt;/p&gt; &lt;p&gt;Exception hierarchies are useful in many ways, mostly because they bring order to the way we handle exceptions.  We can catch a specific exception, or a root exception in a hierarchy, and hanlde them specifically.  But, one of the usages of exception hierarchies is to add additional data to an exception. In many cases, this is very useful data, such as the SQL error code or the details node of in a soap fault or the list of assemblies that could not be loaded.&lt;/p&gt; &lt;p&gt;Do you know what this three datums has in common?&lt;/p&gt; &lt;ol&gt; &lt;li&gt;They are very useful  &lt;/li&gt;&lt;li&gt;&lt;strong&gt;They do not show in ex.ToString()&lt;/strong&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Guess what is going to be shown in any log, error message, etc?&lt;/p&gt; &lt;p&gt;You got that right, the ex.ToString() output!&lt;/p&gt; &lt;p&gt;If you have additional information in the exception, it &lt;em&gt;must&lt;/em&gt; be available on the exception afterward. Trying to diagnose assembly load failures is driving me mad. &lt;/p&gt; &lt;p&gt;Imagine finding things like this in the log:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;"ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information."  &lt;/li&gt;&lt;li&gt;"SoapException: Server was unable to process request"&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Imagine gettting one of those during dev, you have no way of knowing where this is happening. Often you can't even set a breakpoint in the code there, and inspect the exception, because it is handled inside some library code. ASP.Net is a good example of how this can happen, and where this is a highly annoying issue to work with.&lt;/p&gt; &lt;p&gt;To summrise, if you create exceptions, make sure to remember a simple rule, &lt;em&gt;everything&lt;/em&gt; should go in the ex.ToString().&lt;/p&gt;&lt;img src="http://ayende.com/Blog/aggbug/9917.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ayende Rahien</dc:creator>
            <guid>http://ayende.com/Blog/archive/2007/12/06/Exception-handling-best-practices.aspx</guid>
            <pubDate>Thu, 06 Dec 2007 10:05:55 GMT</pubDate>
            <comments>http://ayende.com/Blog/archive/2007/12/06/Exception-handling-best-practices.aspx#feedback</comments>
            <slash:comments>14</slash:comments>
            <wfw:commentRss>http://ayende.com/Blog/comments/commentRss/9917.aspx</wfw:commentRss>
        </item>
        <item>
            <title>A definition of a nightmare platform</title>
            <link>http://ayende.com/Blog/archive/2007/11/11/A-definition-of-a-nightmare-platform.aspx</link>
            <description>&lt;p&gt;&lt;a href="http://blog.bittercoder.com/PermaLink,guid,d9d2ba93-08b4-4495-866e-6a6d9241c02d.aspx"&gt;Alex&lt;/a&gt; has more or less hit on about the worst description of a platform I can think of:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;XYZ is a technology of highs and lows... the highs are when you've finally got something to work that should've worked in the first place, the lows are well... all the times in between.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;If you are working on such a platform, make yourself happy, just go away.&lt;/p&gt;&lt;img src="http://ayende.com/Blog/aggbug/9847.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ayende Rahien</dc:creator>
            <guid>http://ayende.com/Blog/archive/2007/11/11/A-definition-of-a-nightmare-platform.aspx</guid>
            <pubDate>Sun, 11 Nov 2007 14:44:22 GMT</pubDate>
            <comments>http://ayende.com/Blog/archive/2007/11/11/A-definition-of-a-nightmare-platform.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://ayende.com/Blog/comments/commentRss/9847.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Amazon's Dynamo</title>
            <link>http://ayende.com/Blog/archive/2007/10/06/Amazons-Dynamo.aspx</link>
            <description>&lt;p&gt;Okay, Amazon has just published an &lt;a href="http://allthingsdistributed.com/2007/10/amazons_dynamo.html"&gt;interesting paper&lt;/a&gt; about how they manage state for some of their services. The underlying idea is a hash table, distributed, reliable, versioned and simple.  They have some interesting constraints that influenced the design of the system, and it is an interesting, if dry, read.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.25hoursaday.com/weblog/CommentView.aspx?guid=5d0d41ef-028b-4032-aba1-3ff9e27a63b5#commentstart"&gt;Dare&lt;/a&gt; has some comments about it.&lt;/p&gt; &lt;p&gt;I'll limit myself to saying that the data versioning approach is extremely interesting. The idea is that you issue a &lt;em&gt;get(key) &lt;/em&gt;and the result is a set of relevant objects that may need reconciliation. They end with a conclusion that while this may seem like putting a lot of the responsibility in the app developers hands, this is something that they already had to deal with due to the scalability requirements that they face. &lt;/p&gt; &lt;p&gt;I wouldn't want to do this for a small site, but I can see the advantages for scaling &lt;em&gt;wide&lt;/em&gt;. &lt;/p&gt; &lt;p&gt;Amusingly enough, the classic shopping cart sample appears to be a core service for this system, and a complex one. &lt;/p&gt;&lt;img src="http://ayende.com/Blog/aggbug/9742.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ayende Rahien</dc:creator>
            <guid>http://ayende.com/Blog/archive/2007/10/06/Amazons-Dynamo.aspx</guid>
            <pubDate>Sat, 06 Oct 2007 15:04:28 GMT</pubDate>
            <comments>http://ayende.com/Blog/archive/2007/10/06/Amazons-Dynamo.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://ayende.com/Blog/comments/commentRss/9742.aspx</wfw:commentRss>
        </item>
        <item>
            <title>The CLR Sources</title>
            <link>http://ayende.com/Blog/archive/2007/10/03/The-CLR-Sources.aspx</link>
            <description>&lt;p&gt;I have no idea why this isn't in much wider circulation, but this is &lt;em&gt;huge&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;ScottGu has announced that Microsoft is &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/10/03/releasing-the-source-code-for-the-net-framework-libraries.aspx"&gt;Releasing the Source Code for the .NET Framework Libraries&lt;/a&gt;. &lt;/p&gt; &lt;p&gt;I am disappointed to see that even in the tiny source code samples that he has in the post I have violent disagreements (they speak about sealing stuff, which I have serious objection to).&lt;/p&gt; &lt;p&gt;This hopefully means a lot less ReflectorDebugging, although I am not sure about all the implication that this has.&lt;/p&gt;&lt;img src="http://ayende.com/Blog/aggbug/9728.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ayende Rahien</dc:creator>
            <guid>http://ayende.com/Blog/archive/2007/10/03/The-CLR-Sources.aspx</guid>
            <pubDate>Wed, 03 Oct 2007 16:04:43 GMT</pubDate>
            <comments>http://ayende.com/Blog/archive/2007/10/03/The-CLR-Sources.aspx#feedback</comments>
            <slash:comments>10</slash:comments>
            <wfw:commentRss>http://ayende.com/Blog/comments/commentRss/9728.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Something is terribly wrong here...</title>
            <link>http://ayende.com/Blog/archive/2007/08/06/Something-is-terribly-wrong-here.aspx</link>
            <description>&lt;p&gt;And the problem is with me. I kept going over this code, not seeing what was wrong with it, up until I actually &lt;em&gt;read&lt;/em&gt; the code. Argh!&lt;/p&gt; &lt;p&gt;&lt;a href="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/Somethingisterriblywronghere_820B/image.png" atomicselection="true"&gt;&lt;img alt="image" src="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/Somethingisterriblywronghere_820B/image_thumb.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://ayende.com/Blog/aggbug/9594.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ayende Rahien</dc:creator>
            <guid>http://ayende.com/Blog/archive/2007/08/06/Something-is-terribly-wrong-here.aspx</guid>
            <pubDate>Mon, 06 Aug 2007 06:14:57 GMT</pubDate>
            <comments>http://ayende.com/Blog/archive/2007/08/06/Something-is-terribly-wrong-here.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://ayende.com/Blog/comments/commentRss/9594.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Accidental Debugging</title>
            <link>http://ayende.com/Blog/archive/2007/08/01/Accidental-Debugging.aspx</link>
            <description>&lt;p&gt;I stopped today to take a look at someone's bug, to see if I could help. I stepped away about 6 hours later, after going over a code base I have no familiarity with. Encoding issues when a piece of text is routed through Flash, JSON, C#, UTF 9 - 23 and other nice stuff.&lt;/p&gt; &lt;p&gt;Best quote: "Javascript written like C++"&lt;/p&gt; &lt;p&gt;Note to self: String concentration is evil.&lt;/p&gt; &lt;p&gt;I need to get better at evasion techniques :-) &lt;/p&gt;&lt;img src="http://ayende.com/Blog/aggbug/9574.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ayende Rahien</dc:creator>
            <guid>http://ayende.com/Blog/archive/2007/08/01/Accidental-Debugging.aspx</guid>
            <pubDate>Tue, 31 Jul 2007 22:13:22 GMT</pubDate>
            <comments>http://ayende.com/Blog/archive/2007/08/01/Accidental-Debugging.aspx#feedback</comments>
            <wfw:commentRss>http://ayende.com/Blog/comments/commentRss/9574.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Method Equality</title>
            <link>http://ayende.com/Blog/archive/2007/07/27/Method-Equality.aspx</link>
            <description>&lt;p&gt;The CLR team deserve a truly great appreciation for making generics works at all. When you get down to it, it is amazingly complex. Most of the Rhino Mocks bugs stems from having to work at that level. Here is one example,  comparing method equality. Let us take this simple example:&lt;/p&gt; &lt;blockquote&gt;&lt;pre&gt;[TestFixture]
&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; WeirdStuff
{
	&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Test&amp;lt;T&amp;gt;
	{
		&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Compare()
		{
			Assert.AreEqual(GetType().GetMethod("&lt;span style="color: #8b0000"&gt;Compare&lt;/span&gt;"),
				MethodInfo.GetCurrentMethod()
				);
		}
	}

	[Test]
	&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ThisIsWeird()
	{
		&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Test&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&amp;gt;().Compare();
	}
}&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is one of those things that can &lt;em&gt;really&lt;/em&gt; bites you. And it fails only if the type is a generic type, even though the comparison is made of the closed generic version of the type. Finding the root cause was fairly hard, and naturally the whole thing is internal, but eventually I managed to come up with a way to compare them safely:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; AreMethodEquals(MethodInfo left, MethodInfo right)
{
	&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (left.Equals(right))
		&lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;
	&lt;span style="color: #008000"&gt;// GetHashCode calls to RuntimeMethodHandle.StripMethodInstantiation()&lt;/span&gt;
	&lt;span style="color: #008000"&gt;// which is needed to fix issues with method equality from generic types.&lt;/span&gt;
	&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (left.GetHashCode() != right.GetHashCode())
		&lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;
	&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (left.DeclaringType != right.DeclaringType)
		&lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;
	ParameterInfo[] leftParams = left.GetParameters();
	ParameterInfo[] rightParams = right.GetParameters();
	&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (leftParams.Length != rightParams.Length)
		&lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;
	&lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 0; i &amp;lt; leftParams.Length; i++)
	{
		&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (leftParams[i].ParameterType != rightParams[i].ParameterType)
			&lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;
	}
	&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (left.ReturnType != right.ReturnType)
		&lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;
	&lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;
}&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;The secret here is with the call to GetHashCode, which remove the method instantiation code, which is fairly strange concept, because I wasn't aware that you can instantiate methods :-)&lt;/p&gt;&lt;img src="http://ayende.com/Blog/aggbug/9562.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ayende Rahien</dc:creator>
            <guid>http://ayende.com/Blog/archive/2007/07/27/Method-Equality.aspx</guid>
            <pubDate>Fri, 27 Jul 2007 10:01:44 GMT</pubDate>
            <comments>http://ayende.com/Blog/archive/2007/07/27/Method-Equality.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://ayende.com/Blog/comments/commentRss/9562.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Debugging NHibernate</title>
            <link>http://ayende.com/Blog/archive/2007/06/04/Debugging-NHibernate.aspx</link>
            <description>&lt;p&gt;    Today we had a problem with an NHibernate query that was failing which had quite stumped. Pulling the usual tricks didn't work, debugging NHibernate was problematic, since the failing query was &lt;em&gt;damn&lt;/em&gt; complex, and I had no clear idea why this was failing. After a while, I decided that trying the top down approach will not work, and that I need more structure in finding out the issue.&lt;/p&gt;&lt;p&gt;    Did I mentioned that the query was complex? The object model is big as well, and the query managed to touch just about all of it. Getting it slimmed down to a reproducable version was hard, because I wasn't sure what caused the issue, but eventually I managed to get it to fail the way I wanted it. (In the process I walked through parts of NHibernate that I haven't met before, interesting.&lt;/p&gt;&lt;p&gt;    The end result are these tests (there is a reason that I know that C# has a 512 characters limits on identifiers):&lt;/p&gt;&lt;ul&gt;    &lt;li&gt;        CanMakeCriteriaQueryAcrossBothAssociationsWhenBothAssoicationsHasSameColumnKeyNameAndUsingPagingInSqlServer2005&lt;/li&gt;    &lt;li&gt;        CanLoadCollectionUsingLeftOuterJoinWhenBothCollectionsHasTheSameColumnKeyNameAndOneIsNull&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;    I still don't have an answer, but now I have much harder questions...&lt;/p&gt;&lt;div style="PADDING-RIGHT: 4px; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; MARGIN: 0px 30px; BORDER-LEFT: gray thick solid; PADDING-TOP: 4px; BACKGROUND-COLOR: #eeeeee"&gt;This post is dedicated to Rinat, who says that she doesn't knows NHibernate, but can make queries so complex both NHibernate and SQL Server begs for mercy. &lt;/div&gt;&lt;img src="http://ayende.com/Blog/aggbug/9395.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ayende Rahien</dc:creator>
            <guid>http://ayende.com/Blog/archive/2007/06/04/Debugging-NHibernate.aspx</guid>
            <pubDate>Mon, 04 Jun 2007 13:48:18 GMT</pubDate>
            <comments>http://ayende.com/Blog/archive/2007/06/04/Debugging-NHibernate.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://ayende.com/Blog/comments/commentRss/9395.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>