My normal practice is to do development testing of my application with
the Visual Studio debugger set so that exceptions break into the
debugger. I found that the format exceptions when I used a hostname
(instead of IP address) as the UdpAppender's destination were
distracting.

I have an optimization that bypasses the attempted conversion from a
dotted decimal formatted IP address if the string contains anything
other than a digit or decimal point.  In case it's of interest the
affected lines of IPAddressConverter.cs (starting at line 79) are:

if (str.Trim("0123456789.".ToCharArray()).Length == 0) // avoid
expense of exception handling
// if it's definitely NOT an IP address
{
try
{
return IPAddress.Parse(str);
}
catch(FormatException)
{
// Ignore a FormatException, try to resolve via DNS
}


-- 
Mike Blake-Knox

Reply via email to