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.

Even if you're not trying to debug a package, your IDE would often crash/AV'd, unrelated to what you're doing.

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.

Since Windows 10, all releases of RAD Studio have DLLs and packages loaded using Parallel DLL loading by default.
Unknown to RAD Studio engineers, the code in RAD Studio sometimes load the same DLL/package twice, but when the duplicated DLL/package is unloaded, the code got confused, and referred to the address of the unloaded DLL/package. So, when there are code that referred to any address range within the unloaded DLL/package, the IDE crashed / AV'd. If that crash/AV wasn't protected by an exception handler, the IDE goes down!

So, to protect the IDE from crashing, disable parallel DLL loading.

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

To enable Parallel DLL loading:

reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\bds.exe" /v MaxLoaderThreads /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\bds.exe" /v MaxLoaderThreads /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.