473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Exception problem

gh
Hi,

Is it true that the CLR sometimes can't throw the run time
exception? Cause I have just encountered a problem that my program has some
unexpected behaviours. After adding try-catch block to many pieces of code.
It catches an array index out of bound exception. I am using VS.Net 2003 and
is there any way to avoid this?

Regards,
Aaron
Jul 21 '05 #1
5 1641
i'm not sure what you mean by this. the CLR is responsible for executing
code so it exceptions must so it ultimately has to do the throwing. would
you mind explaining some more

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://tinyurl.com/27cok
----------------------------------------------------------
"gh" <gh******@FSAF.COM> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
Hi,

Is it true that the CLR sometimes can't throw the run time
exception? Cause I have just encountered a problem that my program has
some unexpected behaviours. After adding try-catch block to many pieces of
code. It catches an array index out of bound exception. I am using VS.Net
2003 and is there any way to avoid this?

Regards,
Aaron

Jul 21 '05 #2
gh
My program had an array index out of bound problem. I didn't write any
try-catch block to capture this exception. It is supposed that an run time
exception should be thrown and the program terminates. But for my case, it
is not. After adding the try-catch block, the program catches the exception.
"Alvin Bruney [MVP]" <vapor at steaming post office> ¼¶¼g©ó¶l¥ó·s»D:uH**************@TK2MSFTNGP12.phx.g bl...
i'm not sure what you mean by this. the CLR is responsible for executing
code so it exceptions must so it ultimately has to do the throwing. would
you mind explaining some more

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://tinyurl.com/27cok
----------------------------------------------------------
"gh" <gh******@FSAF.COM> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
Hi,

Is it true that the CLR sometimes can't throw the run time
exception? Cause I have just encountered a problem that my program has
some unexpected behaviours. After adding try-catch block to many pieces
of code. It catches an array index out of bound exception. I am using
VS.Net 2003 and is there any way to avoid this?

Regards,
Aaron


Jul 21 '05 #3
Is it possible that the exception is occurring inside of an event handler?
If so, you may have to handle it yourself. In any case, or course, you
should be able to avoid the exception by ensuring that the array size is
never exceeded.
"gh" <gh******@FSAF.COM> wrote in message
news:OU**************@TK2MSFTNGP12.phx.gbl...
My program had an array index out of bound problem. I didn't write any
try-catch block to capture this exception. It is supposed that an run time
exception should be thrown and the program terminates. But for my case, it
is not. After adding the try-catch block, the program catches the
exception.
"Alvin Bruney [MVP]" <vapor at steaming post office>
¼¶¼g©ó¶l¥ó·s»D:uH**************@TK2MSFTNGP12.phx.g bl...
i'm not sure what you mean by this. the CLR is responsible for executing
code so it exceptions must so it ultimately has to do the throwing. would
you mind explaining some more

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://tinyurl.com/27cok
----------------------------------------------------------
"gh" <gh******@FSAF.COM> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
Hi,

Is it true that the CLR sometimes can't throw the run time
exception? Cause I have just encountered a problem that my program has
some unexpected behaviours. After adding try-catch block to many pieces
of code. It catches an array index out of bound exception. I am using
VS.Net 2003 and is there any way to avoid this?

Regards,
Aaron



Jul 21 '05 #4
If you don't use a try-catch then when an exception occurs it becomes an
unhandled exception (UE). The behavior of the system is then determined by
the type of thread the UE occurred on. If it is your main thread then the
program will terminate.

"gh" <gh******@FSAF.COM> wrote in message
news:OU**************@TK2MSFTNGP12.phx.gbl...
My program had an array index out of bound problem. I didn't write any
try-catch block to capture this exception. It is supposed that an run time
exception should be thrown and the program terminates. But for my case, it
is not. After adding the try-catch block, the program catches the
exception.
"Alvin Bruney [MVP]" <vapor at steaming post office>
¼¶¼g©ó¶l¥ó·s»D:uH**************@TK2MSFTNGP12.phx.g bl...
i'm not sure what you mean by this. the CLR is responsible for executing
code so it exceptions must so it ultimately has to do the throwing. would
you mind explaining some more

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://tinyurl.com/27cok
----------------------------------------------------------
"gh" <gh******@FSAF.COM> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
Hi,

Is it true that the CLR sometimes can't throw the run time
exception? Cause I have just encountered a problem that my program has
some unexpected behaviours. After adding try-catch block to many pieces
of code. It catches an array index out of bound exception. I am using
VS.Net 2003 and is there any way to avoid this?

Regards,
Aaron



Jul 21 '05 #5
If your program was throwing an exception, and you weren't catching it, how
do you know it was throwing it?

And if you add an exception handler, and the system starts catching an
error, how do you know you didn't ADD the error when you added the exception
handler?

In other words, a CLR bug is far less likely than a bug that you added in
your app when you added exception handling.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"gh" <gh******@FSAF.COM> wrote in message
news:OU**************@TK2MSFTNGP12.phx.gbl...
My program had an array index out of bound problem. I didn't write any
try-catch block to capture this exception. It is supposed that an run time
exception should be thrown and the program terminates. But for my case, it
is not. After adding the try-catch block, the program catches the exception.

"Alvin Bruney [MVP]" <vapor at steaming post office>

¼¶¼g©ó¶l¥ó·s»D:uH**************@TK2MSFTNGP12.phx.g bl...
i'm not sure what you mean by this. the CLR is responsible for executing
code so it exceptions must so it ultimately has to do the throwing. would you mind explaining some more

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://tinyurl.com/27cok
----------------------------------------------------------
"gh" <gh******@FSAF.COM> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
Hi,

Is it true that the CLR sometimes can't throw the run time
exception? Cause I have just encountered a problem that my program has
some unexpected behaviours. After adding try-catch block to many pieces
of code. It catches an array index out of bound exception. I am using
VS.Net 2003 and is there any way to avoid this?

Regards,
Aaron



Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Páll Ólafsson | last post by:
Hi I have a problem with the Microsoft.ApplicationBlocks.ExceptionManagement? I can't get it to work in RELEASE mode? If I run the project in debug mode the block works fine but when I run the...
3
by: Tony Johansson | last post by:
Hello! When you allocate object dynamically which mean on the heap I find that a problem when using exception. What is the prefer method to handle this kind of problem. //Tony
3
by: Professor Frink | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
16
by: ChInKPoInt [No MCSD] | last post by:
I am using Visual Studio 2K3 writing a ASP.NET web application. Is there a way to force the C# compiler to catch possible exception? In Java, all exceptions thrown MUST BE caught, otherwise...
44
by: craig | last post by:
I am wondering if there are some best practices for determining a strategy for using try/catch blocks within an application. My current thoughts are: 1. The code the initiates any high-level...
40
by: Kevin Yu | last post by:
is it a bad programming design to throw exception in the try block then catch it??
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
7
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote...
2
by: Chris Stiefeling | last post by:
Hi, I am experiencing a strange problem. I am reading and writing xml files via XmlDocument and XmlTextWriter. In the debugger everything works fine but outside the debugger (debug or release)...
3
by: Robert Rawlins | last post by:
Hi Mk, Yeah it's got me a little bemused to be honest, I've tried playing around with configuration options this morning and not been able to achieve anything that works properly. I'll keep...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.