No Stack Trace using JCL in Delphi XE
We have a project which we converted from Delphi 2007 to Delphi XE. In the 2007 version we used the JCL's debugging features to have a stack trace when an Exception appears. In fact we used the JCL's standard ExceptionDlg wizard, which relies on the following line to get开发者_运维问答 the Stack Trace:
StackList := JclLastExceptStackList;
This thing used to work in Delphi 2007 but not anymore in XE (it throws a 'blank' stack).
If we replace that thing with a classical
StackList := JclCreateStackList(false,0,Caller(0,false));
lTemp := TStringList.Create;
StackList.AddToStrings(lTemp,true,true,true,true);
ShowMessage(lTemp.Text);
lTemp.Free;
Stacklist.Free;
...it works (hence we have the correct setings WRT to maps etc.), but (unfortunatelly) it shows the present stack trace (which, of course, leads to the exception dialog) and not to the stack trace of the last exception.
Any ideas how to fix this?
TIA
Did you call JclStartExceptionTracking
?
It seems this method is responsible for hooking up exceptions in the first place and adding a notifier.
function JclStartExceptionTracking: Boolean;
begin
if TrackingActive then
Result := False
else
begin
Result := JclHookExceptions and JclAddExceptNotifier(DoExceptNotify, npFirstChain);
TrackingActive := Result;
end;
end;
精彩评论