Job Tracker isn't working after compiling code

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
AtlasNetworkServices
Posts: 7
Last visit: Mon Jul 10, 2023 8:29 am

Job Tracker isn't working after compiling code

Post by AtlasNetworkServices »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: PowerShell Studio 2022 5.8.213
Operating system: Windows 10 22H2
PowerShell version(s): 5.1, 7.2.0.0, 7.2.7.0, 7.3.0.0

*** Please add details and screenshots as needed below. ***

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

I'm having a problem with Job Tracking not working once I compile the code to a winform executable. My code works as expected in PowerShell Studio IDE but as soon as I create the executable it will no longer work, this seems to be all versions of PowerShell 7. This problem is happening on the computer that I used created the program and another test computer (even did a clean install of Windows 10 on the test computer). If I compile the code to PowerShell 5.1 it works without issues on both computers. I even created a new project and just added the start job button. When I run the program in PowerShell Studio it works just fine, I then compile it to winform executable and it no longer works on both machines. All the prerequisites are installed and the program launches without any issues.

When I click on the button on the compiled program it just does nothing once it gets to the job tracker portion of the code.

Thank you in advance for any help / advice.

Justin
by brittneyr » Fri Jan 06, 2023 10:32 am
We are looking into this and will get back to you soon.

It most likely has to do with the Start-Job command not being supported when PowerShell 7 is being hosted in other applications, such as packaged scripts from our SAPIEN Script Packager.
Start-Job depends on the PowerShell executable to be available under $PSHOME to start an out-of-process background job, but when an application is hosting PowerShell, it’s directly using the PowerShell NuGet SDK packages and won’t have PowerShell executable shipped along.
Go to full post
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Job Tracker isn't working after compiling code

Post by brittneyr »

When the code is running in the IDE, does it work with both v5 and v7?
Brittney
SAPIEN Technologies, Inc.
AtlasNetworkServices
Posts: 7
Last visit: Mon Jul 10, 2023 8:29 am

Re: Job Tracker isn't working after compiling code

Post by AtlasNetworkServices »

brittneyr wrote: Sat Dec 31, 2022 11:08 am When the code is running in the IDE, does it work with both v5 and v7?
Yes, it works in both versions in the IDE.
AtlasNetworkServices
Posts: 7
Last visit: Mon Jul 10, 2023 8:29 am

Re: Job Tracker isn't working after compiling code

Post by AtlasNetworkServices »

I tried compiling the code on another computer with PowerShell Studio 2022 on it and I'm having the exact same problem with the Job Tracker not working.

Product: PowerShell Studio 2022 (64 Bit)
Build: v5.8.213
OS: Windows 10 Pro (64 Bit)
Build: v10.0.22621.0installed
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Job Tracker isn't working after compiling code

Post by brittneyr »

We are looking into this and will get back to you soon.

It most likely has to do with the Start-Job command not being supported when PowerShell 7 is being hosted in other applications, such as packaged scripts from our SAPIEN Script Packager.
Start-Job depends on the PowerShell executable to be available under $PSHOME to start an out-of-process background job, but when an application is hosting PowerShell, it’s directly using the PowerShell NuGet SDK packages and won’t have PowerShell executable shipped along.
Brittney
SAPIEN Technologies, Inc.
AtlasNetworkServices
Posts: 7
Last visit: Mon Jul 10, 2023 8:29 am

Re: Job Tracker isn't working after compiling code

Post by AtlasNetworkServices »

Just checking to see if there is any update on this issue?

Thank you!

Justin
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Job Tracker isn't working after compiling code

Post by brittneyr »

The issue is indeed as I stated above. It's an issue with the Start-Job command when PowerShell 7 is being hosted in another application. While we are aware of the issue, we do not have an implemented solution at this time.

A possible workaround could be to use the Start-ThreadJob command from the module ThreadJob. ThreadJob is just an extension of the existing PowerShell background jobs. The main difference is that the jobs which are created run in separate threads within the local process.
Brittney
SAPIEN Technologies, Inc.
This topic is 1 year and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.