Possible Bug with Switch Statement

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
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.
This topic is 5 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
branhama
Posts: 19
Last visit: Mon Jul 03, 2023 12:25 pm

Possible Bug with Switch Statement

Post by branhama »

Product, version and build: PowerShell Studio 2019 v5.6.159
32 or 64 bit version of product: 64-bit
Operating system: Windows 10 Pro
32 or 64 bit OS: 64-bit

Noticed an issue I believe with Switch statements relating to a $true $false definition.

With the below code Compress-Archive will not be syntax highlighted and tab completions do not function.
*Not Working
  1. $test = $true
  2.  
  3. Switch ($test)
  4. {
  5.     $true{
  6.        
  7.     }
  8.     $false{
  9.         $sample |Compress-Archive -Destinationpath 'C:\test.zip'                   
  10.     }
  11. }
However, if you place a space after $true and $false within the switch code, completion and highlighting begin to function again.
*Working
  1. Switch ($test)
  2. {
  3.     $true {
  4.        
  5.     }
  6.     $false {
  7.         $sample | Compress-Archive -Destinationpath 'C:\test.zip'
  8.     }
  9. }
Is this on purpose? I did not believe the spacing here should be a requirement. Took me a while to figure out what was going on with my tab completion on this one.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Possible Bug with Switch Statement

Post by davidc »

Thank you for reporting this and it is indeed a bug. We are investigating and will keep you updated.
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Possible Bug with Switch Statement

Post by davidc »

We found the issue and it will be resolved in the next service release. In the meantime, adding the extra space will resolve the issue.
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Possible Bug with Switch Statement

Post by davidc »

Please try the latest service build of PowerShell Studio (v5.6.160) and let us know if the issue persists.
David
SAPIEN Technologies, Inc.
This topic is 5 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.