Skip to Content
.NET Common Language Runtime Unleashed
book

.NET Common Language Runtime Unleashed

by Kevin Burton
April 2002
Intermediate to advanced content levelIntermediate to advanced
1024 pages
23h 26m
English
Sams
Content preview from .NET Common Language Runtime Unleashed

P/Invoke Exceptions

Chapter 7, “Leveraging Existing Code—P/Invoke,” dealt with calls into unmanaged code using P/Invoke. Next, you will look specifically at what happens to exceptions that are generated from the unmanaged code.

If an exception is generated in unmanaged code, it is caught and translated to an appropriate managed exception and rethrown. The only exception would be when no appropriate managed exception exists to which to convert. You have already seen that throwing an unspecified exception such as the following

Throw;

results in an SEHException. In fact, any exception that is thrown that cannot be translated to its managed counterpart results in an SEHException.

A sample in the UnmanagedException directory raises four different ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Customizing the Microsoft® .NET Framework Common Language Runtime

Customizing the Microsoft® .NET Framework Common Language Runtime

Steven Pratschner

Publisher Resources

ISBN: 0672321246Purchase book