Catching Exceptions
When you implement Try..Catch..End Try
blocks, you can intercept and handle only CLS-compliant exceptions, that is, exceptions inheriting from System.Exception
. Exceptions wrapped by the COM import tools are not CLS-compliant, so a classic Try
block would fail. To intercept exceptions coming from wrapped objects, the .NET Framework offers the System.Runtime.CompilerServices.RuntimeWrappedException
that can be used for error handling when working with wrappers. The following code shows an example:
Other than usual exception properties, this class exposes a WrappedException
property, of type Object
, which represents the occurred ...
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.