Delphi 10.2 latest build 2004, win x64 VCL application.
Trying to debug my large multi-threaded application, I came across many $ C00000005 exceptions in strange places. The apts to narrow down the problem led me to this minimal example: create some (10 in my case enough to see the problem) threads, compile with "use debug.dcus".
Set a breakpoint in the second sleep and press F9 several times until the value is raised.
When its raised assembly code looks broken (see screenshot). RIP points to the middle of the correct instruction.
When I compile the same test application for Win32, it just hangs in the debugger after several F9, so I can’t even take screenshots of the errors.
Update:
For more information about the initial release, I started looking for a debugger problem: My life program (VCL win x64) sometimes stops working with the error "the problem caused the program to stop working correctly . "
Each thread has an exception logging system, so after such a failure the log is empty, I was hoping that, running in the debugger, it would give me useful information.
Without control points, the application for life sometimes (very rarely, about once every 5 hours) throws an exception, leads deep into system.pas (see the last screen). On this screen, the last System._USstrClr had a null pointer.
Sincerely the same picture that I had when I set a breakpoint in System._USstrClr and hit F9 several times, it ends with nil pointers.
I do not claim that these 2 problems have the same reason, just trying to understand what is happening.
From what I saw, this only happens in the debugger.
The life application compiled using the Release assembly does not throw an exception, it just stops when “the problem caused the program to stop working correctly”, as my users report (and with empty logs without information about any errors).
TMyThread = class (TThread) procedure Execute; override; end; var frmClientTest: TfrmClientTest; ThreadList: TList<TMyThread>; procedure TfrmClientTest.FormCreate(Sender: TObject); var k: integer; begin ThreadList:=TList<TMyThread>.Create; for k:=0 to 10 do ThreadList.Add(TMyThread.Create); end; procedure TMyThread.Execute; begin FreeOnTerminate:=false; repeat sleep(100); sleep(200); until Terminated; end;

CPU:

==================
Real application exception:
