473,385 Members | 1,821 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,385 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
Nov 16 '05 #1
5 1559
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

Nov 16 '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


Nov 16 '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



Nov 16 '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



Nov 16 '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



Nov 16 '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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.