Re: Debug Tracing and Asserts

Sébastien Lorion <[email protected]> Fri, 8 Feb 2008 09:22:55 -0500
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
You could revise the lazy code and make it throw exceptions when a
mandatory component property is missing :p I am a big proponent of
fail fast strategy ... Of course, exception messages need to have as
much info as possible. "Invalid configuration file" is next to
useless, but "Property Foo of component Bar is mandatory. Failed at
line 1234 in file configXYZ.xml" is a gift from heaven for all
testers.

Asserts are nice when you are making assumptions and you want to
verify they are indeed correct, but they should not replace exceptions
for illegal input data ...

Tracing is good to see the data and operation flow, log stuff, etc.

Sébastien

On 2/7/08, Brady Kelly <[email protected]> wrote:
> I'm a raw noob when it comes to using these functions, but feel a need to
>  introduce some controls and audit in my current project.  It is littered
>  with null checks, which mostky do nothing if a component is missing, i.e. a
>  property is null after deserialising because the XML element that represents
>  it was missing.
>
>
>
>  I now have reached a stage where, downstream, I get null reference errors,
>  and I have to trace all the way down the stream, from the spring, so see
>  where and why my property is null.  Could somebody please recommend a good
>  resource on using the features provided by .NET to assist in diagnosing and
>  auditing these scenarios?
>
>
>  ===================================
>  This list is hosted by DevelopMentor(R)  http://www.develop.com
>
>  View archives and manage your subscription(s) at http://discuss.develop.com
>


-- 
Sébastien
www.sebastienlorion.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com