Splat command adding extra curly brace

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.
User avatar
PsCustomObject
Posts: 93
Joined: Tue Apr 29, 2014 1:55 am

Splat command adding extra curly brace

Post by PsCustomObject »

Product, version and build: PowerShell Studio 2019, Build 5.6.170
32 or 64 bit version of product: 64-bit
Operating system: Windows 10 1909

Hello,

it seems the splat command shortcut hates me, or perhaphs I'm just abusing it ;-)

As per subject under specific circumstances the aforementioned shortcut will add extra curly braces to the command, this can easily be reproduced with the following snippet

Code: Select all

Set-QADObject -Identity $objectGuid -ObjectAttributes @{ 'Attr1' = $false } -Service $arsServerName -Proxy
Keep in mind this affects the command only when extra parameters follow the curly brace as this will be correctly splatted

Code: Select all

-Set-QADObject -Identity $objectGuid  -Service $arsServerName -Proxy -ObjectAttributes @{ 'Attr1' = $false }
Don't mind the fact I'm using Quest cmdlets up there as we use ActiveRoles for AD management that will affect any cmdlet/module.

Thanks in advance for looking into this!

User avatar
Olga_B
Site Admin
Posts: 149
Joined: Mon May 15, 2017 9:06 am

Re: Splat command adding extra curly brace

Post by Olga_B »

Thank you for reporting this issue. I'm having trouble recreating this issue.
Could you add screenshot of code after splatting?

And also screenshot of Options for Editor/Formatting

User avatar
PsCustomObject
Posts: 93
Joined: Tue Apr 29, 2014 1:55 am

Re: Splat command adding extra curly brace

Post by PsCustomObject »

Thanks for looking into this Olga, I did some further "testing" (well really writing code out of necessity and as I use the splat shortcut a lot I did this quite some times) and it seems this can not be reproduced at will as I thought.

I restarted the IDE and issue solved itself but given it is not the first time I encounter this it seems the linter sometimes gets confused especially if the code is enclosed as part of some kind of loop where the following line is a curly brace.

Given the fact this cannot be reproduced and mainly seems random I think I will need to live with it.

Anyhow while I was at it I've noticed something else you'll want to look at, this is an unhandled exception which hits me every time steps to reproduce

Create a new script --> Use the splat command (I used the same code as above) without saving the file you will get an unhanlded exception which I'm attaching for your reference.

This seems related to SyntaxEditor not really Sapien PSStudio so not sure if Actipro can do anything about this.
Attachments
Exception.log
(1.2 KiB) Downloaded 28 times

User avatar
brittneyr
Site Admin
Posts: 538
Joined: Thu Jun 01, 2017 7:20 am

Re: Splat command adding extra curly brace

Post by brittneyr »

We found this issue while testing as well and it will be fixed in a future release.
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
brittneyr
Site Admin
Posts: 538
Joined: Thu Jun 01, 2017 7:20 am

Re: Splat command adding extra curly brace

Post by brittneyr »

Please try build 5.7.172 and let me know if there are still problems.
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
PsCustomObject
Posts: 93
Joined: Tue Apr 29, 2014 1:55 am

Re: Splat command adding extra curly brace

Post by PsCustomObject »

Thanks can confirm this is solved!

Great job as usual!