NO .NET ALLOWED

Ironically, the very "compiler magic" that allows CodeSiteEx to function in a Win32 environment is what prevents it from supporting Delphi for .NET.  The problem basically comes down to a fundamental difference in the freeing of objects between Win32 and .NET.

The best explanation of the problem I have seen was from Brad White on the CodeSite newsgroups; he stated:

"The problem is how to make the call to ExitMethod deterministically.  TraceMethod works by returning a reference to an interface.  Since there is no explicit variable to receive the return value, Delphi creates an implicit one.  This goes out of scope at the end of the method, and the object is freed, which calls ExitMethod.

Under Win32, the freeing of the object happens immediately when it goes out of scope.  You always know exactly when the ExitMethod will be called, and it will always be before the next CodeSite message has a chance.

Under .NET, the freeing of the object is 'scheduled' on exit, but doesn't actually happen at any particular time.  So the ExitMethod messages may appear anywhere in the log after it actually happens, and very possibly after any number of other messages.  Not very helpful.  Really the exact opposite of what TraceMethod was supposed to accomplish."