Start-ThreadJob not working when bundling to exe file

Tool: Visual Studio
Version: newest

Been trying for 5 days now to figure out why when I build my script for exe and bundle everything together then Start-Threading is not working at all.

I have a Start-ThreadJob that is logging everytime it does something, I have passed the log path to the scriptblock. But no matter what I do it never actually starts the script it seems.

I have “Bundle” “Package as Executable” “Package Modules” “Obfuscate Executable” enabled and running as powershell 7.2.7. net6.0 windows, x64.

I have tried a million different solutions, but none of them are working. It needs to run in at least 7.2.6 for one of my scripts to run. So i need to get it working with Powershell 7.

Why is Threading not working when script is packaged to .exe file?

I only have one file ps1 file.

Is the script terminating after you use Start-ThreadJob? Or are you keeping the process open somehow?