Structured Exception handling in .Net

  • Thread starter Thread starter Ashutosh
  • Start date Start date
A

Ashutosh

Does .Net have any capability/support for Structured Exception handling?

Thanks & Regards,
Ashutosh
 
Hello Ashutosh

Yes, .NET has the capability and support for SEH. In fact, the CLR
implements its exception handling on top on Window's native
Structured-Exception-Handling (SEH) model.

Take VB.NET as an example,

Structured Exception Handling Overview for Visual Basic
http://msdn.microsoft.com/en-us/library/8a9f2ew0.aspx
<quote>
Visual Basic supports structured exception handling, which you can use to
create and maintain programs with robust, comprehensive error handlers.
Structured exception handling is code designed to detect and respond to
errors during execution by combining a control structure (similar to Select
Case or While) with exceptions, protected blocks of code, and filters.
Using the Try...Catch...Finally statement, you can protect blocks of code
that have the potential to raise errors. You can nest exception handlers,
and the variables declared in each block will have local scope.
</quote>

Does this answer your question? For more readings:

http://www.microsoft.com/msj/0197/exception/exception.aspx
http://blogs.msdn.com/joelpob/archive/2004/03/05/84738.aspx
http://blogs.msdn.com/jmstall/archive/2004/10/04/237741.aspx
http://www.dotnetjunkies.ddj.com/Tutorial/030F9042-C48A-4210-9977-0425C231BF
75.dcik

If you have any other questions or concerns, please feel free to tell me.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi,
Thanks for the reply. I think I didn't make my question very clear.

I know how the C++/C# try-catch-finally are implemented internally. The
catch block is implemented as the exception filter of the SEH.

My question here is, is there any support to directly use the SEH and
not the C++/C# try-catch-finally in C#? The documentation of .Net
doesn't have any keyword as __excpet

Thanks & Regards,
Ashutosh
Hello Ashutosh

Yes, .NET has the capability and support for SEH. In fact, the CLR
implements its exception handling on top on Window's native
Structured-Exception-Handling (SEH) model.

Take VB.NET as an example,

Structured Exception Handling Overview for Visual Basic
http://msdn.microsoft.com/en-us/library/8a9f2ew0.aspx
<quote>
Visual Basic supports structured exception handling, which you can use to
create and maintain programs with robust, comprehensive error handlers.
Structured exception handling is code designed to detect and respond to
errors during execution by combining a control structure (similar to Select
Case or While) with exceptions, protected blocks of code, and filters.
Using the Try...Catch...Finally statement, you can protect blocks of code
that have the potential to raise errors. You can nest exception handlers,
and the variables declared in each block will have local scope.
</quote>

Does this answer your question? For more readings:

http://www.microsoft.com/msj/0197/exception/exception.aspx
http://blogs.msdn.com/joelpob/archive/2004/03/05/84738.aspx
http://blogs.msdn.com/jmstall/archive/2004/10/04/237741.aspx
http://www.dotnetjunkies.ddj.com/Tutorial/030F9042-C48A-4210-9977-0425C231BF
75.dcik

If you have any other questions or concerns, please feel free to tell me.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--
Regards,
Ashutosh Bhawasinka
email: (e-mail address removed)
MCSA - Messaging,
MCTS - .Net Windows Apps
 
Hello Ashutosh,

May I ask why you would need to directly use the SEH and not through the
C++/C# implementation? Given a specific scenario, I may be able to help to
find out some solutions. At the moment, I do not know a way to use SHE
directly, but I will do my best to perform researches and help you with the
issue.

Thanks,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
 
Hi,
Thanks for the reply!!

I am not having any issues. It's just that if I could use it my life
(and the code) will be much more simple...if I use the
EXCEPTION_CONTINUE_EXECUTION feature...

Thanks & Regards,
Ashutosh
 
Back
Top