Wintellect / WintellectPowerShell

PowerShell scripts for better debugging and life
http://www.wintellect.com
Other
178 stars 41 forks source link

Fixed HandleCSharpMainProperties to support Script Blocks #6

Closed dalpert-korewireless closed 7 years ago

dalpert-korewireless commented 7 years ago

I noticed that the inline documentation for this script implies that both CustomGeneralProperties and CustomConfigurationProperties support script blocks but I discovered through trial and error that script blocks only worked with CustomConfigurationProperties.

When I looked at the code I realized that HandleCSharpConfigProperties used an if/else/else block which checked to see if the $item was a script block but HandleCSharpMainProperties used a switch on the value and never checked if $item was a script block.

This commit transposed the

                elseif ($item.Value -is [scriptblock])
                {
                    & $item.Value $configGroup
                }

pattern from HandleCSharpConfigProperties into HandleCSharpMainProperties

JohnWintellect commented 7 years ago

Thanks, Dave! I've been working on a big update to support VS 2017. I've merged this change into that local branch and I'll be pushing it this week. I really appreciate the fix. You rock!