{

Just a quick note from a late night's coding session, something that I sort of knew but finally got fed up enough to begin implementing everywhere. I'm working on a fairly large Windows Forms application and one library devoted to safe type conversion is filled with methods like this (yes, could've used Int32.TryParse, I'm not the original author though... ):

private int ToInt32(object val){
int ret = 0;
try{
ret = Convert.ToInt32(val)
}
catch(Exception ex){
// suppress
}
return ret;
}

It's nice to just attempt conversion and expect a zero for an invalid value, but it's annoying when you've got a method call like:

MyCall(SafeConvert.ToInt32(num1), SafeConvert.ToDecimal(num2));

The easy, clean fix is to apply the System.Diagnostics.DebuggerStepThrough attribute to your method. Any calls to that method are stepped over, making your life in debug mode that much easier.

System.Diagnostics has quite a few other debugger attributes, one of which allows you to mark code that came from a library you didn't write (DebuggerNonUserCode). Very useful indeed, especially when you've got unit tests that can assert something needs never be "debugged" again.

}