Exception after a reinstallation (project is the same)

Hi

In the same way as a previous post (due to reinstallation of Delphi 11.2 to update from 11.1) and reinstall all TMS components.

I had a pb with TMS Logger.

Now from my project (exactly the same as before the installation), I received this exception :


GExperts Debugger Exception Notification

Project Bagueur.exe raised exception class EAccessViolation with message 'Access violation at address 00007FFA3C1F895E. Read of address FFFFFFFF94ECEE80'.

[&Filter ...] [Ignore &All this Session] [Break] [Additional &Info] [Continue]

ThreadId=14260
ProcessId=1
ThreadName=""
ExceptionMessage="Access violation at address 00007FFA3C1F895E. Read of address FFFFFFFF94ECEE80"
ExceptionName="EAccessViolation"
ExceptionDisplayName="$C0000005"
ExceptionAddress=7FFA3C1F895E
FileName=
LineNumber=


I made a new project with the "wrong part", but the exception doesn't exist anymore

PROCEDURE TfDivers.DataModuleCreate(Sender: TObject);
BEGIN
.... 
             TMSLogger.RegisterOutputHandlerClass(TTMSLoggerEventLogOutputHandler);
             TMSLogger.RegisterOutputHandlerClass(
                 TTMSLoggerHTMLOutputHandler,
                 [Rep_Temporaire + '_Logger.html', '_Logger.js']);
             TMSLogger.RegisterOutputHandlerClass(
                 TTMSLoggerCSVOutputHandler,
                 [Rep_Temporaire + '_Logger.csv', '|']);
             TMSLogger.RegisterOutputHandlerClass(
                 TTMSLoggerTextOutputHandler,
                 [Rep_Temporaire + '_Logger.txt']);

        TMSLogger.ExceptionHandling := True;
        // TMSLogger.Outputs := AllOutputs;
        TMSLogger.OutputFormats.ValueFormat := '{%s}';
        TMSLogger.OutputFormats.NameFormat := '[Nom] : {%s}';
        TMSLogger.Clear;
        TMSLogger.Active := True;

        TMSLogger.InfoFormat(
            'Principal : {%s}',
            ['Ouverture']);

The exception occurs at the line :

 TMSLogger.InfoFormat(
            'Principal : {%s}',
            ['Ouverture']);

Please note, I reboot my computer just in case, but no change

I use the 2.5.0.2 version of TMS Logger

regards

Do I understand correctly that the same code works in a new project, but doesn't work in your existing project? If yes, I have some initial questions to try to help you:

  1. What is the full call stack at the moment of the error?
  2. Can you check if TMSLogger is nil right before the line that the error occurs?

Hi

that the same code works in a new project, but doesn't work in your existing project?

Yes that right. And the code of the "existing project" is same before and after reinstall.

  1. What is the full call stack at the moment of the error?

How to do that ? but I tried to see an other info

'Violation d''accès à l''adresse 00007FFA3C1F895E dans le module ''advapi32.dll''. Lecture de l''adresse 00000000244C1C80'

That a good info because by project is compiled on 64bit, and the dll seems 32.

So, I compile the "new project" into 64bit and the same pb occurs :

---------------------------
GExperts Debugger Exception Notification
---------------------------
Project Project4.exe raised exception class ERangeError with message 'Erreur de vérification d'étendue at address 00000000008F2CA5'.
---------------------------
[&Filter ...] [Ignore &All this Session] [Break] [Additional &Info] [Continue]
---------------------------
ThreadId=15084
ProcessId=2
ThreadName=""
ExceptionMessage="Erreur de vérification d'étendue at address 00000000008F2CA5"
ExceptionName="ERangeError"
ExceptionDisplayName="ERangeError"
ExceptionAddress=7FFA3A504FD9
FileName=<not available>
LineNumber=<not available>
ExceptionObject=26375EFD660
Classes=[ERangeError,EIntError,EExternal,Exception,TObject]

I understand you could reproduce the problem in a separate, simple project. Can you then send us the sample project reproducing the issue, so we can debug and fix the issue at our side? Thank you.

Hi

Yes, this project (very small) compiled for Win 32 works, compiled for Win 64 = it fails
logger.zip (5.9 KB)

regards

I already tell you, but I run on Delphi 11.2 (the new one)

Unfortunately I couldn't reproduce the issue. Should I just run the project for Win64 platform and the error should appear?

I'm not using 11.2, however. I'm using 11.1. Do you by chance has a way to test it in another Delphi version (11.1 or lower) to see if the problem still occur?

Do you by chance has a way to test it in another Delphi version (11.1 or lower) to see if the problem still occur?

Unfortunately, not. Because the licence (Academic) I can use only one version. So now 11.2 only.

Note in 11.1, my project worked, but I used the previous version of TMS Logger.

Thus if you can send me this older version I can test it in 11.2 in order to see if the pb occured ?

Did you see a previous message indicated a pb with a dll ?

'Violation d''accès à l''adresse 00007FFA3C1F895E dans le module ''advapi32.dll''. Lecture de l''adresse 00000000244C1C80'

I don't see such Access Violation related to advapi32.dll. Everything just works fine here.

We also don't keep previous version installers. But what was the exact version you were using with 11.1? If it's a recent one, there weren't many changes.

Otherwise, I will try to test it when 11.2 is installed here, shouldn't take long.

Just updated to 11.2 in this development machine. Unfortunately, no errors appear.

Damned !

do you have any advice because it is very punishing? I had to disable the logger activity. :frowning:

I used Windows 10 (Version 10.0.19044 Build 19044)

I tried to go into more detail, the problem occurs into Unit TMSLoggingEventLogOutputHandler at line 133 in bold) into procedure TTMSLoggerEventLogOutputHandler.LogOutput :

procedure TTMSLoggerEventLogOutputHandler.LogOutput(

{$IFDEF MSWINDOWS}
P := PWideChar(msg);
if Length(Server) = 0 then
EventLog := RegisterEventSource(nil, PWideChar(Source))
else
EventLog := RegisterEventSource(PWideChar(Server), PWideChar(Source));

Follow goes to Unit System :( (line 30446)

function _UStrToPWChar(const S: UnicodeString): PWideChar;
begin
  Result := Pointer(S);  // Result = 'Project4.exe'
  if Result = nil then
    Result := @(PEmptyString(Pointer(EmptyStringW))^.Nul);
end;

goes to WinApi.Windows (line 39348) and crash

function RegisterEventSource; external advapi32 name 'RegisterEventSourceW';

and the call stack is
Capture d’écran 2022-09-21 080946

After this crash, and exception occurs (of course). Here the screenshot of this exception :

and the "event" file from delphi
event.txt (7.2 KB)

Have you tried to execute the compiled application in different Windows machines to see if the error happens?

Good idea.

I am just trying.
Result :

  • 32bit vers = Ok
  • 64bit vers = fails with a same error message
    image

here the porject exe :
Project4.zip (4.0 MB)

Thank you. Just to let you know that we were able to reproduce and fix the issue. Next release will include the fix.

T.H.A.N.K.S Y.O.U :+1: :+1: :+1:

The next version will arrive soon ? because it is very "frustrating" :(

We should release it in one or two weeks.

:disappointed_relieved:

May I ask you a way to correct your source in order to reactivate the logger? :grin:

Actually the solution is rather simple, in unit TMSLoggingEventLogOutputHandler.pas, line 121, just redeclare the EventLog variable like this:

{$IFDEF MSWINDOWS}
  EventLog: THandle;

That should be enough.

Thanks you

I did it but unfortunately, it doesn't work. The crash still occurs :frowning:

Have you recompiled all the packages for 64-bit in both Release and Debug config? Just modifying the source code is not enough.