Search

Two spaces plus breakpoint can crash ISE in certain conditions by SteveLarson-W

Active

1
0
Sign in
to vote
Type: Bug
ID: 770416
Opened: 11/7/2012 3:32:53 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
The following code will soft crash the ISE if a breakpoint is on any line 1-3:
$temppso = New-Object PSObject -Property @{
DistanceUnit = "Miles"
}
$temppso # returns object

However, it will work as expected without the breakpoint on any line 1-3 OR without the two (or more) spaces at the front of line 1.
Details (expand)
How often does this happen?
Always Happens

Have you seen this problem before in this product?

No, this is new to the most recent version
Reproduction Steps
Take the following code:
$temppso = New-Object PSObject -Property @{
DistanceUnit = "Miles"
}
$temppso # returns object

It runs as expected with or without a breakpoint set on any line 1-3.
Put two spaces in front of line 1 without a breakpoint on any line 1-3 and run (F5). It runs as expected.
Leave the two spaces in front of line 1, put a breakpoint on any line 1-3, and run (F5). This will soft crash the ISE (accepts no input and the status at the bottom says "Failed").

Depending on what is around the problem area and where breakpoints are set, other errors indicate the ISE is "confused" after the error. In the errors given below it indicates that execution continues after the problem statement, back up to the switch statement, and down to the output statement (this results in soft crash the ISE (accepts no input and the status at the bottom says "Completed")).
[DBG]: PS C:\Windows\system32>>
Specified argument was out of the range of valid values.
Parameter name: length
At C:\Users\slarson\Documents\PowerShell\Get-GeoCode.ps1:384 char:21
+                     $temppso = New-Object PSObject -Property @{
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo         : OperationStopped: (:) [], ArgumentOutOfRangeException
    + FullyQualifiedErrorId : System.ArgumentOutOfRangeException

State of Windows PowerShell instance is not valid to create a nested Windows PowerShell instance. Nested Windows PowerShell should be created only for a running Windows
PowerShell instance.
At C:\Users\slarson\Documents\PowerShell\Get-GeoCode.ps1:374 char:17
+         switch ($Service)
+                 ~~~~~~~~
    + CategoryInfo         : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidOperation

The variable '$temppso' cannot be retrieved because it has not been set.
At C:\Users\slarson\Documents\PowerShell\Get-GeoCode.ps1:466 char:9
+         $temppso # returns object
......
Expected Results
Output the object:
DistanceUnit
------------
Miles
File Attachments
0 attachments
Sign in to post a comment.
Sign in to post a workaround.