Lastest Windows Insider Builds - Collection is read-only
Attempting to import a module and run a PowerShell script is now resulting in an error about the collection is read-only.
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NoLogo -ExecutionPolicy Bypass -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1'"
C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1 : Collection is read-only.
At line:1 char:210
+ ... ller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunn .
+ CategoryInfo : NotSpecified: (:) [chocolateyScriptRunner.ps1]
+ FullyQualifiedErrorId : System.NotSupportedException,chocolateyScriptR
This is new and unexpected behavior. Here is the issue log for more information: https://github.com/chocolatey/choco/issues/659
Here is the actual script in question - https://github.com/chocolatey/choco/blob/0.9.9.11/src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1 - it could be that we are using a keyword now in the script, but the error looks like it is coming from specifying the module, followed by the script as we start up PowerShell.
Is this an expected change or a bug? And is there a workaround?
It's likely now that we are trying to set a variable that is new that didn't exist before and it is a readonly collection.
I'm gathering details for all versions of PowerShell on the ticket at https://github.com/chocolatey/choco/issues/659#issuecomment-198379365 and https://github.com/chocolatey/choco/issues/659#issuecomment-198384906
More information - it appears it is something in the file itself.