# Thursday, June 16, 2005

Gunjan Doshi: Using Visual Studio.Net to edit NAnt build files
[via Bill Arnette on WinTechOffTopic]

This very quickly makes the NAnt build script editing environment a lot more pleasant and productive.

Thursday, June 16, 2005 11:05:37 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

For some reason I always have to go searching for this sample code when I want it and it's never as easy to find as I want it to be.  This is a very nice starting point for creating your own custom exception classes in C#.  The translation to VB.NET is straightforward.

using System;
using System.Runtime.Serialization;

namespace YourNamespaceHere
{
    /// <summary>
    /// YourCustomException is a vanilla custom exception for this application.
    /// </summary>
    [Serializable()]
    public class YourCustomException : Exception, ISerializable
    {
        /// <summary>
       
/// Calls the default exception constructor.
       
/// </summary>
       
public YourCustomException()
        {
        }
       
/// <summary>
       
/// Calls the default exception constructor with a message parameter.
       
/// </summary>
       
/// <param name="message">The exception message.</param>
       
public YourCustomException(string message) : base(message)
        {
        }
       
/// <summary>
       
/// Calls the default exception constructor with a message and innerException parameter.
       
/// </summary>
       
/// <param name="message">The exception message.</param>
       
/// <param name="inner">The inner exception.</param>
       
public YourCustomException(string message, Exception inner): base(message, inner)
        {
        }
       
/// <summary>
       
/// Calls the default exception constructor with a serialization info and streaming context parameter.
       
/// </summary>
       
/// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
       
/// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
       
public YourCustomException(SerializationInfo info, StreamingContext context) : base( info, context )
        {
        }
    }
}

Note that there is some controversy regarding whether you are supposed to inherit from Exception or ApplicationException for custom exceptions due to Microsoft giving inconsistent guidance.

This is the source of information I've giving the most authority to on this issue in my choice of inheriting from Exception:

Brad Abrams Blog

Thursday, June 16, 2005 11:10:04 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, June 14, 2005

Trying to run NDoc (1.3.1) on a newly setup PC, I ran into this error:

From the NDoc GUI:
---
An error occured while trying to build the documentation.

Exception: NDoc.Core.DocumenterException
Unable to find the HTML Help Compiler. Please verify that the HTML Help Workshop has been installed.

Exception: NDoc.Core.DocumenterException
Unable to find the HTML Help Compiler. Please verify that the HTML Help Workshop has been installed.
---

From the NAnt NDoc Utility:
---
Error building documentation.
    Unable to find the HTML Help Compiler. Please verify that the HTML Help Workshop has been installed.
        Unable to find the HTML Help Compiler. Please verify that the HTML Help Workshop has been installed.
---

As of today, it's not well documented on Google what this error really means.

The fix was to rerun the VS.NET 2003 installer (Control Panel -> Add/Remove Programs -> Select VS.NET -> Change/Remove). Then add the "Enterprise Development Tools->Visual Studio SDKs->HTML Help 1.3 SDK" item.

My original guess was that I got the error because I hadn't installed the MSDN library yet.  Thanks to this weblog entry for pointing me in the right direction (toward the VS.NET installer):

What is "HTML Help Workshop"?

If I were Microsoft, I wouldn't consider the HTML Help compiler as part of the "Enterprise Development Tools" package and hide it in the installer.  NDoc is a best practice that every developer who is writing a component/library should use, not just enterprise developers.  IMHO, hhc.exe should be part of the core VS.NET install.

Tuesday, June 14, 2005 10:38:37 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
# Sunday, June 12, 2005

I am a huge proponent of "fail fast" as a best practice.

Here's a great writeup of what Fail Fast means.  It was written by Jim Shore and edited by Martin Fowler.

Sunday, June 12, 2005 6:17:23 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  |