Jeffery Richter makes the following statement in two books, the first was
written in 2004, the latter in 2002.
"You should not define new exception classes derived from
ApplicationExce ption; use Exception instead."
..NET Framework Standard Library Annotated Reference, Volume 1: Base Class
Library and Extended Numerics Library (2004) http://www.aw-bc.com/catalog/academi...894-DS,00.html
Exception Management Application Block for .NET http://www.amazon.com/exec/obidos/tg...31854?v=glance
I own about 15 C# books, and most of them claim that you should always
inherit from ApplicationExce ption. I am putting some finishing touches on a
class library that I have written in C#, the classes are very similar to the
classes found in System.IO namespace, my library handles very long directory
names and file names, the existing Directory and File classes in FCL can not
do this. I would like to make a good decision on implementation of Exception
Handling for my classes.
Additionally, I also noticed that the "Exception Management Block for .NET"
(April 2002), is inheriting from ApplicationExce ption. I am hesitant to use
it because of Jeffery's comments. He seems to be a well trusted author. http://msdn.microsoft.com/library/de...ml/emab-rm.asp
What is the latest scoop on this? Should I follow Jeffery's advice, or
should I "anger the saints" and inherit from ApplicationExce ption?
Thanks
Russell Mangel
Las Vegas, NV
PS
I wish not, to die of mis-print. 6 6273
Hi Russell,
"Russell Mangel" <ru*****@tymer. net> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. Jeffery Richter makes the following statement in two books, the first was written in 2004, the latter in 2002. "You should not define new exception classes derived from ApplicationExce ption; use Exception instead."
<snip> What is the latest scoop on this? Should I follow Jeffery's advice, or should I "anger the saints" and inherit from ApplicationExce ption?
I'm not sure why Richter is so emphatic with his advice. It is simply the
case that there is no compelling reason to derive from ApplicationExce ption
over Exception. Brad Abrams posted an excerpt from his book that discusses
ApplicationExce ption: http://blogs.msdn.com/brada/archive/.../25/96251.aspx
Regards,
Daniel
Hi,
AFAIK the recommended way is that you should derive from
ApplicationExce ption, in fact I think that FxCOP has a rule that check this
, also it has a rule saying that you should not catch Exception .
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Russell Mangel" <ru*****@tymer. net> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. Jeffery Richter makes the following statement in two books, the first was written in 2004, the latter in 2002. "You should not define new exception classes derived from ApplicationExce ption; use Exception instead."
.NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library (2004) http://www.aw-bc.com/catalog/academi...894-DS,00.html
Exception Management Application Block for .NET http://www.amazon.com/exec/obidos/tg...31854?v=glance I own about 15 C# books, and most of them claim that you should always inherit from ApplicationExce ption. I am putting some finishing touches on
a class library that I have written in C#, the classes are very similar to
the classes found in System.IO namespace, my library handles very long
directory names and file names, the existing Directory and File classes in FCL can
not do this. I would like to make a good decision on implementation of
Exception Handling for my classes.
Additionally, I also noticed that the "Exception Management Block for
..NET" (April 2002), is inheriting from ApplicationExce ption. I am hesitant to
use it because of Jeffery's comments. He seems to be a well trusted author. http://msdn.microsoft.com/library/de...ml/emab-rm.asp What is the latest scoop on this? Should I follow Jeffery's advice, or should I "anger the saints" and inherit from ApplicationExce ption?
Thanks Russell Mangel Las Vegas, NV
PS I wish not, to die of mis-print.
Hi Ignacio,
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. Hi,
AFAIK the recommended way is that you should derive from ApplicationExce ption, in fact I think that FxCOP has a rule that check
this , also it has a rule saying that you should not catch Exception .
Cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
Recommended by whom? Not the same folks who brought us
ApplicationExce ption 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
ApplicationExce ption vs. Exception?
Regards,
Daniel
Hi, Recommended by whom? Not the same folks who brought us ApplicationExce ption 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 ApplicationExce ption vs. Exception?
MS ???? http://msdn.microsoft.com/library/de...classtopic.asp
except:
ApplicationExce ption 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 ApplicationExce ption class. ApplicationExce ption
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 ApplicationExce ption 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...sp?frame=false
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Daniel has a point - both Jeff Richter and much of the BCL team have said
that APplicationExce ption was a mistake. See the ".Net Framework Standard
Library Annotated Reference Vol1"
You can see an excerpt of it with the ApplicationExce ption annotations here: http://blogs.msdn.com/brada/archive/.../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
ApplicationExce ption thinking it would add value by grouping exceptions
declared outside of the .NET Framework, but there is no scenario for
catching ApplicationExce ption and it only adds unnecessary depth to the
hierarchy."
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:us******** *****@TK2MSFTNG P14.phx.gbl... Hi,
Recommended by whom? Not the same folks who brought us ApplicationExce ption 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 ApplicationExce ption vs. Exception?
MS ???? http://msdn.microsoft.com/library/de...classtopic.asp
except: ApplicationExce ption 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 ApplicationExce ption class. ApplicationExce ption 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 ApplicationExce ption 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...sp?frame=false
Cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
Hi,
Insteresting read. thanks for the link.
It does have a point, I never catch the ApplicationExce ption, 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" <ju**@mckraken. com> wrote in message
news:ea******** ******@tk2msftn gp13.phx.gbl... Daniel has a point - both Jeff Richter and much of the BCL team have said that APplicationExce ption was a mistake. See the ".Net Framework Standard Library Annotated Reference Vol1"
You can see an excerpt of it with the ApplicationExce ption annotations
here: http://blogs.msdn.com/brada/archive/.../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 ApplicationExce ption thinking it would add value by grouping exceptions declared outside of the .NET Framework, but there is no scenario for catching ApplicationExce ption and it only adds unnecessary depth to the hierarchy."
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
wrote in message news:us******** *****@TK2MSFTNG P14.phx.gbl... Hi,
Recommended by whom? Not the same folks who brought us ApplicationExce ption 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 ApplicationExce ption vs. Exception?
MS ???? http://msdn.microsoft.com/library/de...classtopic.asp except: ApplicationExce ption 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 ApplicationExce ption class. ApplicationExce ption 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 ApplicationExce ption 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...sp?frame=false
Cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Useko Netsumi |
last post by:
in php.ini? Thank
|
by: Fuzzyman |
last post by:
Hello,
To create a classic (old style) class, I write :
class foo:
pass
To do the equivalent as a new style class, I write :
class foo(object):
|
by: CaribSoft |
last post by:
I want to create my own common dialog to use in an application . How do I
show a custom dialog (form) in a class based on the common dialog class?
|
by: moondaddy |
last post by:
Are frame pages really taboo in asp.net and if so, why and what's the down
side of using them? I'm trying to use user controls instead, but it seems
that a lot of things were a lot easier with frames and the user experience
was better. Some one please enlighten me.
--
moondaddy@nospam.com
|
by: Ryan Ternier |
last post by:
I just got moved to a project that has an inheritance structure sort of like
this:
MyWebPage.aspx
inherits ---> MyWebPage.ASPX.VB
inherits ----> Utility.VB
inherits -----> DHTMLMenu.vb
inherits ----> System.WEb.UI.Page
Whenever I load up my aspx page, i get an error because it can't find the
| |
by: Tad Marshall |
last post by:
Hi,
I'm having limited luck getting an ApplicationException to work right in my
code. This is VB.NET, VS 2003, Windows XP SP2, .NET Framework 1.1.
I thought it would be convenient to take advantage of exception handling to
deal with the case of the user clicking the Cancel button while a long
operation was running. So, I declared a class inherited from
ApplicationException and I Throw one of these with the text "User pressed
Cancel"...
|
by: toton |
last post by:
Hi,
I want to have a vector like class with some additional functionality
(cosmetic one). So can I inherit a vector class to add the addition
function like,
CorresVector : public vector<Corres>{
public:
void addCorres(Corres& c); //it do little more than push_back
function.
}
|
by: bg_ie |
last post by:
Hi,
I have the following Program.cs -
namespace TestFrameworkApplication
{
static class Program
{
/// <summary>
/// The main entry point for the application.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |