CnPack Forum » CnWizards IDE Wizards » Bug in cnDebug.pas TraceObjectWithTag/LogObjectWithTag


2020-3-25 17:40 MrOuzo
Bug in cnDebug.pas TraceObjectWithTag/LogObjectWithTag

Hello,

i think there is a bug in TraceObjectWithTag/LogObjectWithTag, the ATag is not evaluated

[code]procedure TCnDebugger.TraceObjectWithTag(AObject: TObject;
  const ATag: string);
{$IFNDEF NDEBUG}
var
  List: TStringList;
  Intfs: string;
{$ENDIF}
begin
{$IFNDEF NDEBUG}
  List := nil;
  try
    List := TStringList.Create;
    try
      AddObjectToStringList(AObject, List, 0);
      Intfs := FormatObjectInterface(AObject);
      if Intfs <> '' then
      begin
        List.Add('Supports Interfaces:');
        List.Add(Intfs);
      end;
    except
      List.Add(SCnObjException);
    end;
    TraceMsgWithType('Object: ' + IntToHex(Integer(AObject), CN_HEX_DIGITS) + SCnCRLF +
      List.Text, cmtObject);
  finally
    List.Free;
  end;
{$ENDIF}
end;[/code]

i think the new code is

[code]procedure TCnDebugger.TraceObjectWithTag(AObject: TObject;
  const ATag: string);
{$IFNDEF NDEBUG}
var
  List: TStringList;
  Intfs: string;
{$ENDIF}
begin
{$IFNDEF NDEBUG}
  List := nil;
  try
    List := TStringList.Create;
    try
      AddObjectToStringList(AObject, List, 0);
      Intfs := FormatObjectInterface(AObject);
      if Intfs <> '' then
      begin
        List.Add('Supports Interfaces:');
        List.Add(Intfs);
      end;
    except
      List.Add(SCnObjException);
    end;
    TraceMsgWithTypeTag('Object: ' + IntToHex(Integer(AObject), CN_HEX_DIGITS) + SCnCRLF +
      List.Text, cmtObject, ATag);    // <----- here
  finally
    List.Free;
  end;
{$ENDIF}
end;[/code]

2020-6-2 14:09 Passion
Oh, thanks for the bug report.

Now I fix it.:handshake

页: [1]


Powered by Discuz! Archiver 5.0.0  © 2001-2006 Comsenz Inc.