FolderBrowserModernDialog not working in compiled .exe

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by davidc » Fri Jan 15, 2016 11:34 am

What build do you have installed? I tested this on my end and the settings save.

It could be that it can't override the *.psproj.psbuild file. You can check the file and look for:
STA=1

David
David
SAPIEN Technologies, Inc.

User avatar
dan.potter
Posts: 709
Joined: Wed Oct 08, 2014 6:02 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by dan.potter » Fri Jan 15, 2016 12:25 pm

I packed an exe for him v3 (windows forms) x64 with sta mode and he couldn't run it.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by davidc » Fri Jan 15, 2016 5:54 pm

tirwin,

Please post in the product support forums and we will assist you further.

David
David
SAPIEN Technologies, Inc.

User avatar
tirwin@iot.in.gov
Posts: 40
Joined: Mon Oct 19, 2015 5:45 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by tirwin@iot.in.gov » Mon Jan 18, 2016 7:23 pm

Was wondering if anyone had any ideas about the above problem? :?: I don't understand why it would work in my ISE but not in the compiled program? I freezes my app with "Not Responding" displayed at the top of the form. I checked the "STA mode" in the "Engine Settings" dialog and tried to compile but it still does not work. Also when I reopen the "Engine Settings" it has the "STA Mode" unchecked again. (This does not seen right). Any help would be greatly appreciated.

jvierra
Posts: 14014
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: FolderBrowserModernDialog not working in compiled .exe

Post by jvierra » Mon Jan 18, 2016 7:29 pm

From your previous posts it appear you are trying to run the form under the V2 commandline host. That won't work.

Image

Notice that this is the commandline host.

jvierra
Posts: 14014
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: FolderBrowserModernDialog not working in compiled .exe

Post by jvierra » Mon Jan 18, 2016 7:35 pm

Here is how to package a form:
bldfrm.jpg
bldfrm.jpg (83.39 KiB) Viewed 1773 times

User avatar
tirwin@iot.in.gov
Posts: 40
Joined: Mon Oct 19, 2015 5:45 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by tirwin@iot.in.gov » Tue Jan 19, 2016 5:32 am

I was wondering if anyone had any ideas about the above problem. The FolderModernDialog works in the ISE but does not work in the compiled program. When I run the compiled program it "Freezes". I get "Not Responding" at the top of the form and I have to stop it from the task manager. I tried the above mentioned in the "Engine Settings" I checked the "STA Mode" box and recompiled and ran the program and it still freezes up. Also when I reopen the "Engine Setting" dialog the "STA Mode" box is not checked. (This does not seem correct). I have no ideas to correct this cold someone help.

User avatar
tirwin@iot.in.gov
Posts: 40
Joined: Mon Oct 19, 2015 5:45 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by tirwin@iot.in.gov » Tue Jan 19, 2016 7:13 am

Follow up on above. I have put the following script in my code per this page.
https://www.sapien.com/blog/2015/03/09/ ... -sta-mode/
and it still does not work. Also I have put a Label on my form with the following cmd.
$testexe.Text = $Host.Runspace.ApartmentState
and the $testexe.Text is empty. Yes my default powershell version is 2.0

jvierra
Posts: 14014
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: FolderBrowserModernDialog not working in compiled .exe

Post by jvierra » Tue Jan 19, 2016 7:28 am

You need to create the simplest form that has the problem and post the whole form. I suspect you are doing something in the form that is corrupting the runtime.

Post the PSF file. If it is not a scripting error then you either have a corrupted Net Framework or a corrupted PowerShell Studio installation.

User avatar
dan.potter
Posts: 709
Joined: Wed Oct 08, 2014 6:02 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by dan.potter » Tue Jan 19, 2016 7:54 am

jvierra wrote:You need to create the simplest form that has the problem and post the whole form. I suspect you are doing something in the form that is corrupting the runtime.

Post the PSF file. If it is not a scripting error then you either have a corrupted Net Framework or a corrupted PowerShell Studio installation.

I gave him a basic form and he said the system either refuses to run it or stops responding when run as admin. I'm guessing system issue or security policy. What is the execution policy set to?

Locked