Often, when I try to debug a package in RAD Studio (the host) by debugging the package with a new instance of RAD Studio (the debuggee), the debuggee would hang some of the time while loading its packages.
It turns out that the hang was caused by a feature introduced in Windows 10, called Parallel DLL loading.Parallel DLL loading speeds up the loading of DLL dependencies by spawning multiple threads to load DLLs.
To enable Parallel DLL loading:
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\bds.exe" /v MaxLoaderThreads /freg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\bds.exe" /v MaxLoaderThreads /f /reg:32
To disable Parallel DLL loading:
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\bds.exe" /v MaxLoaderThreads /t REG_DWORD /d 1 /f reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\bds.exe" /v MaxLoaderThreads /t REG_DWORD /d 1 /f /reg:32
For me, it turns out that parallel DLL loading is the cause of many exceptions and hangs that I've seen with RAD Studio. Disabling parallel DLL loading fixes it.
A method pointer is now the same as a global procedure, ie, procedure of object = procedure.