Hello,
I have a PS2012 project containing a button which calls SaveFileDialog.ShowDialog().
The AutoUpgradeEnabled property is set to True.
When I run the project in PS2012, it works fine.
If I export the project to a single file and run it from the commandline, it hangs when I press the button.
If I change AutoUpgradeEnabled to False in the project, then it works.
Is that normal on Windows 2008? Should I always set that property to False?
Thanks.
SaveFileDialog with AutoUpgradeEnabled = True hangs ...
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.
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.
Re: SaveFileDialog with AutoUpgradeEnabled = True hangs ...
Read the following about this: http://msdn.microsoft.com/en-us/library ... .110).aspx
Re: SaveFileDialog with AutoUpgradeEnabled = True hangs ...
Also the File Dialogs require STA mode. When you set the value to true or leave it at the default the upgrade is attempted on 2008 (Vista and later). The UI requires STA with the wrapped dialogs.
Re: SaveFileDialog with AutoUpgradeEnabled = True hangs ...
Thanks, I'm running on Windows 2008, not Vista, so why does it cause a problem? Is it a bug in Windows or PS2012?
Any idea how to run a PS2012 GUI script from the commandline in STA mode?
Any idea how to run a PS2012 GUI script from the commandline in STA mode?
Re: SaveFileDialog with AutoUpgradeEnabled = True hangs ...
It is the same on all vista and later systems. WS2008 is post-vista. It uses the Vista UI and the enhanced "chrome/aero" interface. IF you want to use the dialogs you must use an STA setting for PowerShell.
powershell -sta
powershell -sta
Re: SaveFileDialog with AutoUpgradeEnabled = True hangs ...
Ok thanks again.
I've exported the GUI script from PS2012 to a single file and it works fine without specifying the -sta on the commandline. So it must be set by default in 2008 or in the PS2012 export?
I've exported the GUI script from PS2012 to a single file and it works fine without specifying the -sta on the commandline. So it must be set by default in 2008 or in the PS2012 export?
Re: SaveFileDialog with AutoUpgradeEnabled = True hangs ...
Nope not what is happening. YOU cannot set the threading model in a script. It is set on the engine.
By default PowerShell runs STA. Some shortcuts may have -MTA set.
In PS2012 there is a button on the toolbar that toggles STA/MTA.
With all of that in mind go back and test. I suspect you are explain things a little bit off from what is happening.
By default PowerShell runs STA. Some shortcuts may have -MTA set.
In PS2012 there is a button on the toolbar that toggles STA/MTA.
With all of that in mind go back and test. I suspect you are explain things a little bit off from what is happening.
Re: SaveFileDialog with AutoUpgradeEnabled = True hangs ...
When you drop the file dialog control set onto your form you will see a message pop up. It says that "STA" mode is required. Apparently you missed the warning. Be sure STA mode is set in PS2012.
Re: SaveFileDialog with AutoUpgradeEnabled = True hangs ...
When I run PS2012 project I get this banner in PS2012:
PowerShell Code
Double-click the code block to select all.>> Running (Demo-MsoUsers.pff) Script... >> Platform: V4 64Bit (STA) (Forced)Even if I just drop the control on a new form PS2012 will force run the form in STA mode. If I copy the script to ths clipboard and paste into PowerShell running in MTA mode it will hang when the dialog is opened.
Re: SaveFileDialog with AutoUpgradeEnabled = True hangs ...
Just to be sure I just ran the same tests on WS2008. THe default or STA mode of PowerShell has no issues.
If you are using PowerShell V2 ISE it may be running in MTA mode. I am not sure about that but I seem to remember that it runs that way in V2.
If you are using PowerShell V2 ISE it may be running in MTA mode. I am not sure about that but I seem to remember that it runs that way in V2.