First, let's replace the CodeSite object with a TCSObjectEx control on our form, as follows:

Next, we'll update the Button's OnClick event to issue a TraceMethod call instead of CodeSite's EnterMethod and ExitMethod procedures:

When we run this code, the "Invalid Pointer Operation" error message appears as expected:

The message sent to the CodeSite viewer is a little different this time.  Click on the thumbnail below to see the viewer's contents full size.

As you can see, this time the message sent to the CodeSite viewer is complete; that is, the ExitMethod is NOT skipped when the exception occurs.  This is the power of TraceMethod.

Now, you may be asking yourself "I thought TraceMethod had a built-in exception notification system; why isn't the error sent to CodeSite?".  This is certainly a fair question.  The answer is simple enough.  While it is true that TraceMethod has an exception notification system, TraceMethod itself is not an error reporting tool.  TraceMethod is designed to receive notification about the exception and react accordingly, completing its own assigned tasks - in this case, the assigned task is tracing the entry and exit points of the ButtonClick method.

To send the exception details to CodeSite, one needs to include the csxErrorTrapControl...