473,387 Members | 1,532 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,387 software developers and data experts.

try/catch in C#

Is "catch" in C# going to catch all exception, or it just catch the
exceptions induced by "throw"? Will it also catch those "structured
exceptions" that could be either from system modules or other DLL or COM
objects of native code?

If seeing a dialog of this:

"Unhandled exception at 0x8f345690 in vsdv.exe: 0xC0000005. Access violation
reading location 0x02313000."

Can we assume that this is a "structured exception" if all the managed code
has try/catch in place?
Nov 18 '06 #1
2 2710
Hello pack,

pIs "catch" in C# going to catch all exception, or it just catch the
pexceptions induced by "throw"?

What's the "all exeptions"?
Catch handles all managed exception

pWill it also catch those "structured
pexceptions" that could be either from system modules or other DLL or
pCOM objects of native code?

Yep, but CLR is responsible for pick them up and wrapping into managed exception

pIf seeing a dialog of this:
p"Unhandled exception at 0x8f345690 in vsdv.exe: 0xC0000005. Access
pviolation reading location 0x02313000."
pCan we assume that this is a "structured exception" if all the
pmanaged code has try/catch in place?

Not sure about this.
As I said before SEH is wrapper by CLR and u can end up with error throw
where u not expect it.
For this case u need provide handling of unhandled expection with appdomain.CurrentDomain.UnhandledException
I recommed to read this http://blogs.gotdotnet.com/cbrumme/a.../01/51524.aspx
where detailed unmanaged and managed exception handling is explained

---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Nov 18 '06 #2
It is all depending on which did you put your try..catch block.

chanmm
"pack" <pa****@comcast.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Is "catch" in C# going to catch all exception, or it just catch the
exceptions induced by "throw"? Will it also catch those "structured
exceptions" that could be either from system modules or other DLL or COM
objects of native code?

If seeing a dialog of this:

"Unhandled exception at 0x8f345690 in vsdv.exe: 0xC0000005. Access
violation
reading location 0x02313000."

Can we assume that this is a "structured exception" if all the managed
code
has try/catch in place?


Nov 19 '06 #3

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

Similar topics

10
by: Gary.Hu | last post by:
I was trying to catch the Arithmetic exception, unsuccessfully. try{ int a = 0, b = 9; b = b / a; }catch(...){ cout << "arithmetic exception was catched!" << endl; } After ran the program,...
11
by: kaeli | last post by:
Hey all, I'd like to start using the try/catch construct in some scripts. Older browsers don't support this. What's the best way to test for support for this construct so it doesn't kill...
4
by: Abhishek Srivastava | last post by:
Hello All, I have seen code snippets like try { ..... } catch {
11
by: Pohihihi | last post by:
I was wondering what is the ill effect of using try catch in the code, both nested and simple big one. e.g. try { \\ whole app code goes here } catch (Exception ee) {}
13
by: Benny | last post by:
Hi, I have something like this: try { // some code } catch // note - i am catching everything now {
23
by: VB Programmer | last post by:
Variable scope doesn't make sense to me when it comes to Try Catch Finally. Example: In order to close/dispose a db connection you have to dim the connection outside of the Try Catch Finally...
32
by: cj | last post by:
Another wish of mine. I wish there was a way in the Try Catch structure to say if there wasn't an error to do something. Like an else statement. Try Catch Else Finally. Also because I...
23
by: pigeonrandle | last post by:
Hi, Does this bit of code represent complete overkill?! try { //create a treenode TreeNode tn = new TreeNode(); //add it to a treeview tv.Nodes.Add(tn);
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.