PowerShell ISE Freezes after executing WinForms
Hello, I've been having an issue with my PowerShell ISE. I am currently developing a PowerShell script that generates Windows Forms for gathering and displaying data. From what I can tell, the application runs and works great. However, after I execute the code once in the ISE (and close the app/stop execution gracefully); if I leave the ISE idle, for about 10 minutes, the ISE will freeze and I have to crash it with Task Manager. If winform code has not been executed, ISE works fine indefinitely. Thoughts on why my ISE constantly crashes when working on winform based scripts? Thanks.
  • Edited by bcehr Tuesday, July 28, 2015 3:17 PM
July 28th, 2015 3:17pm

jrv, I have been attempting to create tickets with Microsoft Support for this issue but have gotten no support from Microsoft. They claim it is a developer problem, even though it appears to definitely be a bug with the ISE (see link below).  Thoughts on how I can better approach this? 

Here is a link with others with this same issue:

http://stackoverflow.com/questions/30808084/using-windows-forms-locks-up-powershell-ise-minutes-after-script-has-terminated


  • Edited by bcehr 17 hours 21 minutes ago
Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 9:50am

jrv, I have been attempting to create tickets with Microsoft Support for this issue but have gotten no support from Microsoft. They claim it is a developer problem, even though it appears to definitely be a bug with the ISE (see link below).  Thoughts on how I can better approach this? 

Here is a link with others with this same issue:

http://stackoverflow.com/questions/30808084/using-windows-forms-locks-up-powershell-ise-minutes-after-script-has-terminated


  • Edited by bcehr 17 hours 14 minutes ago
August 31st, 2015 9:56am

Hi there.

I am building a little program to implement easier GUIs for/in Powershell as readable script.

I cant even count how many times the ISE crashed. By my experiences the crashes occured on debugging something more complicated. My motivation was not very high to find the error because it did not disturb my work too much and after a restart all scripts were reloaded and afterwards it worked for some hours again.

Though - yeah. Debugging XAML or WinForms causes often Crashes in ISE.

Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 10:00am

Yeah, smaller winform programs haven't been a huge issue, they can work for several hours at a time. But my bigger scripts, containing say 3000 lines with dozens of winform objects, are crashing every few minutes; dozens of times a day and costing a lot of time (not to mention I keep losing all my test variables in my active shell). It seems the large the scripts, the faster the crashes.
August 31st, 2015 10:08am

Oh well.

You could gather a dump of the ISE with ProcDump to see why this is crashing on your site so often. Probably we can find a hint so the ISE/error can be fixed.

Link    ProcDump

Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 10:25am

The ISE is an editor. It is not really intended to be used in production.  Use the CLI version of PowerShell to run WinForms.

August 31st, 2015 11:26am

Jrv, yeah i'm using the ISE as a code editor. Once the script goes into production, it will be launched with the CLI version of PowerShell.  However, the crashing that is plaguing me comes from while actively writing and debugging the code in the ISE. When I run the script in order to test/debug it, PowerShell ISE crashes shortly after the debug session/test run is complete.  This requires me to crash and re-launch ISE nearly every time I test a new line of code...
Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 12:04pm

This is an issue with debugger.  All IDEs have this issue. It says you have a very subtle bug in your code.  Possible a leak or something that is corrupting the Windows structures.    It happens to all developers.

You need to break your script apart and test pieces until you have found the issue.  If you are not experienced in design of Windows code then you will likely have serious design issues on a large project.

Remember that all event code must be cared for carefully.  I have seen code where a user left a timer running which crashed to system after the Window closed.

In CLI with a script file you never would see the lockup because PowerShell shuts down before the timer ticks.  In ISE the coode ends but the GUI remains. A timer tick or other late event will now lock the GUI.

August 31st, 2015 12:37pm

jrv, I have been attempting to create tickets with Microsoft Support for this issue but have gotten no support from Microsoft. They claim it is a developer problem, even though it appears to definitely be a bug with the ISE (see link below).  Thoughts on how I can better approach this? 

Here is a link with others with this same issue:

http://stackoverflow.com/questions/30808084/using-windows-forms-locks-up-powershell-ise-minutes-after-script-has-terminated


  • Edited by bcehr Monday, August 31, 2015 1:49 PM
Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 1:49pm

Jrv, thanks for the reply.  That was my original thought as well, but I literally went through the code and did a manual Remove-Variable for EVERY object in the code to cleanup and terminate everything and the ISE still freezes.  Running Get-Variable | Remove-Variable after script execution also still results in the ISE locking up after a short time.  I have also read other users having this same problem with even a simple winform application with a simple form with one control on it.  Wondering if possibly could be a bug in the ISE in relation to winforms? Or there something else in my code I could be missing?


  • Edited by bcehr 12 hours 29 minutes ago
August 31st, 2015 2:41pm

Jrv, thanks for the reply.  That was my original thought as well, but I literally went through the code and did a manual Remove-Variable for EVERY object in the code to cleanup and terminate everything and the ISE still freezes.  Running Get-Variable | Remove-Variable after script execution also still results in the ISE locking up after a short time.  I have also read other users having this same problem with even a simple winform application with a simple form with one control on it.  Wondering if possibly could be a bug in the ISE in relation to winforms? Or there something else in my code I could be missing?


  • Edited by bcehr 12 hours 22 minutes ago
Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 2:47pm

Every case I have seen it was a coding error.  If you doubt that then open a case with MS support.  If they find a bug the case will be free.

I do not recommend that non-programmers build complex GUI apps with PowerShell. IF you run into a crisis you will find it very difficult to find the cause as you are seeing.

 

August 31st, 2015 6:28pm

Jrv, thanks for the reply.  That was my original thought as well, but I literally went through the code and did a manual Remove-Variable for EVERY object in the code to cleanup and terminate everything and the ISE still freezes.  Running Get-Variable | Remove-Variable after script execution also still results in the ISE locking up after a short time.  I have also read other users having this same problem with even a simple winform application with a simple form with one control on it.  Wondering if possibly could be a bug in the ISE in relation to winforms? Or there something else in my code I could be missing?


  • Edited by bcehr Monday, August 31, 2015 6:41 PM
Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 6:40pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics