473,403 Members | 2,323 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,403 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 2712
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: 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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
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...
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.