OVERVIEW

One of CodeSite's most powerful features is method tracing.  Using the EnterMethod and ExitMethod procedures, one can send messages to CodeSite that will represent the entry and exit points of a method.  However, there is a "gotcha" when using these methods: if Exit is called or an exception is raised inside the method, CodeSite's ExitMethod procedure won't be called.

To protect against this, developers would normally wrap their procedure in a try..finally block, ending up with code that looks like this:

       procedure MyProc;
       begin
         CodeSite.EnterMethod('MyProc');
         try
           { MyProc body goes here... }
         finally
           CodeSite.ExitMethod('MyProc');
         end;
       end;

Obviously, typing this over and over can be rather tedious.  Even if a Delphi code template is used to automatically add the code skeletons, it can be a chore to remove them later.

CodeSiteEx can clean up the above code so it looks like this:

       procedure MyProc;
       begin
         CodeSiteEx.TraceMethod('MyProc');
         { MyProc body goes here... }
       end;