473,385 Members | 1,973 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.

C#: Can all unmanaged exceptions and others be caught in managed code?

Can all unmanaged exceptions and others be caught in managed code? Or, you can do nothing to avoid your managed application to crash. Suppouse, you cannot modify the unmanaged code.

If you have the following piece of code in c#: (please, ignore syntax errors if is the case)

try {
call_to_unmanaged_code();
} catch (Exception e) {
do_something();
}
Nov 30 '06 #1
1 1848
MMcCarthy
14,534 Expert Mod 8TB
Welcome to thescipts.

You are more likely to get an answer to your question if you post it in th C++/C forum.

http://www.thescripts.com/forum/forum129.html

Mary


Can all unmanaged exceptions and others be caught in managed code? Or, you can do nothing to avoid your managed application to crash. Suppouse, you cannot modify the unmanaged code.

If you have the following piece of code in c#: (please, ignore syntax errors if is the case)

try {
call_to_unmanaged_code();
} catch (Exception e) {
do_something();
}
Dec 1 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

24
by: mag31 | last post by:
Is there any way to find out if a particular .net function will throw an exception without first generating the exception? I am using structured exception handling i.e. try catch finally blocks...
0
by: Niall | last post by:
I'm attempting to put a C# front end on my unmanaged C++ ray tracer code. It's still in experimental stage, as I have never done anything with exporting types from an unmanaged dll through to a...
2
by: asanford | last post by:
We use StackWalk(StackWalk64) from dbghelp.dll to walk our callstacksas needed, using the various Sym* methods (SymGetSymFromAddr, SymGetLineFromAddr) to resolve source file, function name, and...
12
by: Bret Pehrson | last post by:
Suppose the following: // Unmanaged code class UnmanagedException /* not visible outside of unmanaged code */ { }; void DoSomething() /* visible (exported) to managed code */ { throw new...
12
by: Vasco Lohrenscheit | last post by:
Hi, I have a Problem with unmanaged exception. In the debug build it works fine to catch unmanaged c++ exceptions from other dlls with //managed code: try { //the form loads unmanaged dlls...
4
by: William F. Kinsley | last post by:
My understanding is that when I re-compile a existing MFC application with the /clr switch, that the code generated is managed(with some exceptions) but that the data isn't, i.e. not garbage...
2
by: yaron | last post by:
Hi, How do i catch an unmanaged c++ exceptions ? right now i can catch the System.Runtime.InteropServices.SEHException and System.Exception exceptions , but i wan't to catch myException...
1
by: caa | last post by:
I have made a simple text example. I have two projects. First is an unmanaged static lib, containing function F(), which created an object of type A and throws an exception. The second project is...
0
by: akash | last post by:
Hi, I've got some C# code instantiating a managed C++ class which in turn instantiates an unmanaged C++ class. I'm getting intermittent exceptions caught by my C# code, but the I can't get any...
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: 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: 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?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.