Product: PowerShell Studio 2022 (64 Bit)
Build: v5.8.208
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.19044.0
PSVersion: 7.2.2
Working on a very small project that uses a small form and accesses a Password Vault (KeePass) on the local machine. The form will run great in the designer when testing. Upon load ("$Main_Load"), the module "Microsoft.PowerShell.SecretStore" is imported, and the cmdlet "Unlock-SecretVault -name VAULTNAME" prompts the user for a password to unlock the vault, and then accesses the vault, and populates a value in a text field. In the designer, the form prompts the user for the password, and then loads successfully, populating the text field. However, once compiled into an exe in the Packager, the main GUI form doesn't actually display. A prompt appears asking for the vault password, and then the form never displays. Task Manager shows the application running as a local process, but the actual form itself never displays.
I moved the Unlock-SecretVault command to the "$Main_Shown" event, and the form then loads (so we're making progress), prompts the user for the unlock password, and then appears to hang. It never populates the text field. Again, with this modification, it works great in the designer. It falls apart once compiled into an .exe.
Compiled using Script Engine Sapien PowerShell 7.2.2 Host (Windows Forms)
Not sure where to go at this point. I don't understand the disconnect between run in the designer and compiled into executable.
Thanks for any insight you can provide.
Compiled application won't display form
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.
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.
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: Compiled application won't display form
Are your STA settings in PowerShell Studio and when packaging different?
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Compiled application won't display form
Thanks for the suggestion. I checked the setting, and STA was enabled in the packager...same as in the designer. Unfortunately, I also attempted compiling and running the app with STA disabled (in both designer and packager) with the same result (runs in the designer but hangs once compiled). Form runs in the designer, but once compiled, no luck.
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: Compiled application won't display form
Threading in PowerShell is always tricky.
Try importing the module and prompt for the password before your even create the form object.
Try importing the module and prompt for the password before your even create the form object.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.