You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I got the same error, it starts failing on line 505 in ModuleBuilder which is the line 42 in the above snippet from InitializeBuild.ps1.
It happens in integration tests in Sampler module pipeline that is using PS5.1, integration tests for PS7.x works.
The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: At D:\a\1\s\output\RequiredModules\ModuleBuilder\3.1.6\ModuleBuilder.psm1:505 char:30
##[error] + }
##[error] + ~
##[error] The hash literal was incomplete.
##[error] At D:\a\1\s\output\RequiredModules\ModuleBuilder\3.1.6\ModuleBuilder.psm1:509 char:34
##[error] + } elseif($BuildInfo.Version) {
##[error] + ~
##[error] Unexpected token '{' in expression or statement.
##[error] At D:\a\1\s\output\RequiredModules\ModuleBuilder\3.1.6\ModuleBuilder.psm1:533 char:1
##[error] + }
##[error] + ~
I just installed the module in 5.1 and encounter the same error for psm1:505 as well.
As a test I tried wrapping the value definition in a subexpression and the module loaded.
Using this code as a test:
When executing it in Windows Powershell 5.1 it errors that the hashliteral is incomplete.
When executing it in Pwsh 7.5.0 it completes and outputs successfully.
Changing the code to use a subexpression like this works in both versions:
Activity
johlju commentedon Feb 17, 2025
I think I got the same error, it starts failing on line 505 in ModuleBuilder which is the line 42 in the above snippet from InitializeBuild.ps1.
It happens in integration tests in Sampler module pipeline that is using PS5.1, integration tests for PS7.x works.
grey0ut commentedon Mar 6, 2025
I just installed the module in 5.1 and encounter the same error for psm1:505 as well.
As a test I tried wrapping the value definition in a subexpression and the module loaded.
Using this code as a test:
When executing it in Windows Powershell 5.1 it errors that the hashliteral is incomplete.
When executing it in Pwsh 7.5.0 it completes and outputs successfully.
Changing the code to use a subexpression like this works in both versions:
Oh, now I see that #136 fixes this by changing the order of the definition. That works too it seems.
dan-hughes commentedon Apr 12, 2025
Fixed in #136