Groups | Blog | Home
all groups > c# > november 2003 >

c# : catching exceptions throm in an imported DLL


Chris R
11/23/2003 5:14:46 PM
You can layer your Exceptions (from most specific to generic, as shown) to
catch more than one type of exception.

try
{
function_in_an_imported_dll();
}
catch (myexception e)
{
e.showreason();
}
catch ( Exception e)
{
// Use e.ToString()
// In preferred manner.
}
catch
{
// Some other exception.
}
finally
{
// Any cleanup.
}

Chris R.

[quoted text, click to view]

Sagaert Johan
11/23/2003 9:26:39 PM
How do i solve the issue of calling an MFC dll function that throws an
exeption ?
i call the dll from a c# app.

Now i use an empty catch but this way i can't get any more information about
the thrown exception.
Maybe i need to remove the exception from my dll function and replace it
with an error code.

try
{
function_in_an_imported_dll();
}
catch (myexception e)
{
e.showreason();
}



Johan







AddThis Social Bookmark Button