Ok so if that is when you start Lazarus from the desktop ...
@Martin_fr
The debugger is the default FpDebug. IDE is the default IDE
Didn't find View>DebugWindows>Stacktrace. but did find >Call Stack ...same thing? Attached screen shot.
@Jamie thanks but switching off Smart App didn't make any difference
Yes same thing. Sorry I didn't check the name correctly (I just typed from memory).
Keeping in mind their is a small chance stacks can be wrong (e.g. corrupted at the time of an error) => It looks like this is the OS loading libraries.
If (another big if) I read it correctly, then this is even before FPC's system init code runs. (though that may have been called, and control may be back to Windows).
That would mean, at this point the OS is loading libraries (and that can be libraries imposed by the OS, so not even controlled by your code or fpc). And one of those libraries fails.
If that is the case, that can be an OS lib (but then others should have it too). Or it can be something from a 3rd party app (well I know that from when you open the file dialog, when libraries from office, pdf, and many other apps are all loaded into your app / if you want it or not does not matter). I don't know for sure at app-startup...
Though I hear, that some games install very intrusive "anti cheat" stuff... And I have no idea what else may do so...
So their is a change that this is an interaction with some other software that you have on your system. (And I would then consider it a bug in that software).
In the menu "debug windows" there is also "event log"
=> open that,
=> right click, and open options
=> enable "module" in the checkbox-list
=> then see if it reports any library loaded. I don't know if it will (at that early stage). But if it does, then maybe it will tell the name of the dll.
EDITFor me the following libs get loaded (when starting a 32 bit app in a 32 bit IDE on Win 11 64 bit OS). Order may vary sometimes
Loaded: ntdll.dll (\\?\C:\Windows\SysWOW64\ntdll.dll)
Loaded: KERNEL32.DLL (C:\WINDOWS\SysWOW64\KERNEL32.DLL)
Loaded: KERNELBASE.dll (C:\WINDOWS\SysWOW64\KERNELBASE.dll)
Loaded: oleaut32.dll (C:\WINDOWS\SysWOW64\oleaut32.dll)
Loaded: msvcp_win.dll (C:\WINDOWS\SysWOW64\msvcp_win.dll)
Loaded: ucrtbase.dll (C:\WINDOWS\SysWOW64\ucrtbase.dll)
Loaded: combase.dll (C:\WINDOWS\SysWOW64\combase.dll)
Loaded: RPCRT4.dll (C:\WINDOWS\SysWOW64\RPCRT4.dll)
Loaded: user32.dll (C:\WINDOWS\SysWOW64\user32.dll)
Loaded: win32u.dll (C:\WINDOWS\SysWOW64\win32u.dll)
Loaded: GDI32.dll (C:\WINDOWS\SysWOW64\GDI32.dll)
Loaded: gdi32full.dll (C:\WINDOWS\SysWOW64\gdi32full.dll)
Loaded: advapi32.dll (C:\WINDOWS\SysWOW64\advapi32.dll)
Loaded: msvcrt.dll (C:\WINDOWS\SysWOW64\msvcrt.dll)
Loaded: sechost.dll (C:\WINDOWS\SysWOW64\sechost.dll)
Loaded: shell32.dll (C:\WINDOWS\SysWOW64\shell32.dll)
Loaded: ole32.dll (C:\WINDOWS\SysWOW64\ole32.dll)
Loaded: shlwapi.dll (C:\WINDOWS\SysWOW64\shlwapi.dll)
Loaded: imm32.dll (C:\WINDOWS\SysWOW64\imm32.dll)
Loaded: comdlg32.dll (C:\WINDOWS\SysWOW64\comdlg32.dll)
Loaded: shcore.dll (C:\WINDOWS\SysWOW64\shcore.dll)
Loaded: ws2_32.dll (C:\WINDOWS\SysWOW64\ws2_32.dll)
Loaded: version.dll (C:\WINDOWS\SysWOW64\version.dll)
Loaded: comctl32.dll (C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.26100.8875_none_85ba9419f7ac12e3\comctl32.dll)
Loaded: winmm.dll (C:\WINDOWS\SysWOW64\winmm.dll)
Loaded: wsock32.dll (C:\WINDOWS\SysWOW64\wsock32.dll)
Loaded: winspool.drv (C:\WINDOWS\SysWOW64\winspool.drv)
Loaded: cfgmgr32.dll (C:\WINDOWS\SysWOW64\cfgmgr32.dll)
Loaded: uxtheme.dll (C:\WINDOWS\SysWOW64\uxtheme.dll)
Loaded: msimg32.dll (C:\WINDOWS\SysWOW64\msimg32.dll)
Loaded: dwmapi.dll (C:\WINDOWS\SysWOW64\dwmapi.dll)
Loaded: shfolder.dll (C:\WINDOWS\SysWOW64\shfolder.dll)
Loaded: windows.storage.dll (C:\WINDOWS\SysWOW64\windows.storage.dll)
Loaded: profapi.dll (C:\WINDOWS\SysWOW64\profapi.dll)
Loaded: kernel.appcore.dll (C:\WINDOWS\SysWOW64\kernel.appcore.dll)
Loaded: bcryptPrimitives.dll (C:\WINDOWS\SysWOW64\bcryptPrimitives.dll)
Loaded: MSCTF.dll (C:\WINDOWS\SysWOW64\MSCTF.dll)
Loaded: textinputframework.dll (C:\WINDOWS\SysWOW64\textinputframework.dll)
Loaded: CoreMessaging.dll (C:\WINDOWS\SysWOW64\CoreMessaging.dll)
Loaded: CoreUIComponents.dll (C:\WINDOWS\SysWOW64\CoreUIComponents.dll)
Loaded: wintypes.dll (C:\WINDOWS\SysWOW64\wintypes.dll)
Loaded: CRYPTBASE.DLL (C:\WINDOWS\SysWOW64\CRYPTBASE.DLL)
Loaded: TextShaping.dll (C:\WINDOWS\SysWOW64\TextShaping.dll)