Re: Inheriting from ApplicationException - Taboo? Jeffrey Richter says so...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ignacio Machin \( .NET/ C# MVP \) ("Ignacio)
Date: 10/06/04


Date: Wed, 6 Oct 2004 13:58:06 -0400

Hi,

 Insteresting read. thanks for the link.

 It does have a point, I never catch the ApplicationException, either catch
the particular exception I'm interested or Exception , which I confess that
catch most of the time, almost all of the warnings I get from FxCOP is that,
catching Exception.

Cheers,

-- 
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Philip Rieck" <junk@mckraken.com> wrote in message
news:eaFaiC7qEHA.3988@tk2msftngp13.phx.gbl...
>
> Daniel has a point - both Jeff Richter and much of the BCL team have said
> that APplicationException was a mistake.  See the ".Net Framework Standard
> Library Annotated Reference Vol1"
>
> You can see an excerpt of it with the ApplicationException annotations
here:
> http://blogs.msdn.com/brada/archive/2004/03/25/96251.aspx
>
>
> This quote is from "KC", or "Krzystof Cwalina (Program Manager ,CLR)"
> "Designing exception hierarchies is tricky. Well-designed exception
> hierarchies are wide, not very deep, and contain only those exceptions for
> which there is a programmatic scenario for catching. We added
> ApplicationException thinking it would add value by grouping exceptions
> declared outside of the .NET Framework, but there is no scenario for
> catching ApplicationException and it only adds unnecessary depth to the
> hierarchy."
>
>
> "Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote
> in message news:usBRff6qEHA.332@TK2MSFTNGP14.phx.gbl...
> > Hi,
> >
> >
> >>     Recommended by whom? Not the same folks who brought us
> >> ApplicationException in the first place (the BCL team). They are of the
> >> opinion it was a mistake. Do you think there is a value in deriving
from
> >> ApplicationException vs. Exception?
> >
> >
> > MS ????
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemapplicationexceptionclasstopic.asp
> >
> > except:
> > ApplicationException is thrown by a user program, not by the common
> > language
> > runtime. If you are designing an application that needs to create its
own
> > exceptions, derive from the ApplicationException class.
> > ApplicationException
> > extends Exception, but does not add new functionality. This exception is
> > provided as means to differentiate between exceptions defined by
> > applications versus exceptions defined by the system.
> >
> > As explained ApplicationException function is to differentiate between
an
> > exception generate by the user code and not by the runtime. In a similar
> > way
> > that SystemException is the base for several exceptions that are
generated
> > by the runtime and considered not fatals.
> >
> > For further info see:
> >
http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp?frame=false
> >
> >
> > Cheers,
> >
> > -- 
> > Ignacio Machin,
> > ignacio.machin AT dot.state.fl.us
> > Florida Department Of Transportation
> >
> >
> >
>
>


Relevant Pages

  • Re: Need help with ApplicationException
    ... Yes there is a "userid name" variable in the employee object. ... I am not sure why I am using ApplicationException instead of Exception. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Inheriting from ApplicationException - Taboo? Jeffrey Richter says so...
    ... that APplicationException was a mistake. ... See the ".Net Framework Standard ... You can see an excerpt of it with the ApplicationException annotations here: ... "Designing exception hierarchies is tricky. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Exceptions in Business Classes
    ... application exception class is some future change they will make. ... > using ApplicationException. ... > an ApplicationException any differently than the base Exception class. ... > recent post in Brad Abrams' blog points this out ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Inheriting from ApplicationException - Taboo? Jeffrey Richter says so...
    ... ApplicationException, in fact I think that FxCOP has a rule that check this ... also it has a rule saying that you should not catch Exception. ... the existing Directory and File classes in FCL can ... > should I "anger the saints" and inherit from ApplicationException? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Exceptions as return values
    ... KC - Designing exception hierarchies is tricky. ... ApplicationException thinking it would add value by grouping exceptions ... catching ApplicationException and it only adds unnecessary depth to the ...
    (microsoft.public.dotnet.languages.csharp)