•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Software Development category of DaniWeb, a massive community of 428,251 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,192 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Software Development advertiser: Programming Forums
Jul 27th, 2006, 10:29 am
DID YOU KNOW?
Do you know how to understand exceptions in DOTNET when they occur? Below is the exception of a program that has crashed:
Unhandled Exception: System.DivideByZeroException: Attempted to divide by zero.
at System.Decimal.FCallDivide(Decimal& result, Decimal d1, Decimal d2)
at System.Decimal.Divide(Decimal d1, Decimal d2)
at Calc.Features.Divide(Decimal First_Num, Decimal Second_Num)
at Calc.CalcMain.Main(String[] args)
When I got this message on my screen, I didn’t understand anything thing at first. But if we look closely, we can retrieve bits of information from it.
On the first Line, we see this:
“Unhandled Exception: System.DivideByZeroException: Attempted to divide by zero”
From this particular line, we can understand 3 things. The first one is the “Unhandled Exception”. This immediately tells us that this is an exception and it could be handled (stopped) but it wasn’t done by the programmer.
The second thing is the Exception in question, that is: “DivideByZeroException”. Thus, if you do a search in the .NET SDK about this exception, you can get details of how this particular exception is triggered and how it must be properly handled.
Then at the end we have: “Attempted to divide by zero”. This is like a clear error message to a simple computer user that tells him how the error occurred and to the programmer, how the exception was triggered.
Next we have a couple of sentences that start with “at”. These are sort of a record of where the bogus code transited. There is a particular way to read this message. Eventually, this must not be read from top to bottom but the reverse:
The “at Calc.CalcMain.Main(String[] args)” tells us the Main Function where all started.
The “at Calc.Features.Divide(Decimal First_Num, Decimal Second_Num)” is the Method that is responsible to divide two numbers. Thus this is where the error occurred.
The others are too obscure for us to take attention. Now we already know what the bug is, how it occurred and how it can be stopped.
Do you know how to understand exceptions in DOTNET when they occur? Below is the exception of a program that has crashed:
Unhandled Exception: System.DivideByZeroException: Attempted to divide by zero.
at System.Decimal.FCallDivide(Decimal& result, Decimal d1, Decimal d2)
at System.Decimal.Divide(Decimal d1, Decimal d2)
at Calc.Features.Divide(Decimal First_Num, Decimal Second_Num)
at Calc.CalcMain.Main(String[] args)
When I got this message on my screen, I didn’t understand anything thing at first. But if we look closely, we can retrieve bits of information from it.
On the first Line, we see this:
“Unhandled Exception: System.DivideByZeroException: Attempted to divide by zero”
From this particular line, we can understand 3 things. The first one is the “Unhandled Exception”. This immediately tells us that this is an exception and it could be handled (stopped) but it wasn’t done by the programmer.
The second thing is the Exception in question, that is: “DivideByZeroException”. Thus, if you do a search in the .NET SDK about this exception, you can get details of how this particular exception is triggered and how it must be properly handled.
Then at the end we have: “Attempted to divide by zero”. This is like a clear error message to a simple computer user that tells him how the error occurred and to the programmer, how the exception was triggered.
Next we have a couple of sentences that start with “at”. These are sort of a record of where the bogus code transited. There is a particular way to read this message. Eventually, this must not be read from top to bottom but the reverse:
The “at Calc.CalcMain.Main(String[] args)” tells us the Main Function where all started.
The “at Calc.Features.Divide(Decimal First_Num, Decimal Second_Num)” is the Method that is responsible to divide two numbers. Thus this is where the error occurred.
The others are too obscure for us to take attention. Now we already know what the bug is, how it occurred and how it can be stopped.
This blog entry was written by Mahen. It has received 611 views, 0 comments, and 2 linkbacks.
Post Comment
•
•
•
•
Only community members can start a blog or comment on blog entries. You must register or log in to contribute.
•
•
•
•
•
•
•
•
DaniWeb Software Development Marketplace
Related Blog Entries
- Thunder Tables Kill Microsoft 40-bit Encryption (2 Days Ago)
- CMG: Free Performance Data and White Papers (4 Days Ago)
- The six million dollar World of Warcraft bot (12 Days Ago)
- Flash May Soon Brighten the iPhone (13 Days Ago)
- Q and A with Electric Cloud CEO Mike Maciag (15 Days Ago)
- Apple Updates Its Java VM (16 Days Ago)
- Why did Apple take 5 months to fix 24 security holes in OS X Java? (17 Days Ago)
- 'Preflight' Your Builds for More Continuous Integration (26 Days Ago)
- VMware: REAL Write Once, Run Anywhere (27 Days Ago)
- Zend to Link its PHP Tools With Adobe Flex, Dojo (27 Days Ago)