Once of my deployments uses a Grant Permissions script from the Octopus library (https://library.octopusdeploy.com/#!/step-template/actiontemplate-file-system-grant-permissions). Since upgrading to Octopus 3.1, this step is failing with some rather odd errors:
Method invocation failed because [System.Security.Cryptography.AesCryptoServiceProvider] doesn’t contain a method named Dispose’.
At C:\Octopus\Work\20150918141944-42\Bootstrap.Script.ps1:87 char:19+ $provider.Dispose <<<< () + CategoryInfo : InvalidOperation: (Dispose:String) , RuntimeException + FullyQualifiedErrorId : MethodNotFound
Any ideas what might be causing this?
Thanks for reaching out. Was that script working on that exact same Tentacle before 3.1? What version of Powershell and the .NET framework is that machine running? If unsure, run this snippet on the machine
gci 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' |
sort pschildname -des |
select -fi 1 -exp pschildname -OutVariable dotnet | Out-Null
Write-Output ".Net version: $dotnet"
Write-Output "Powershell version: $($PSVersionTable.Psversion)"
I had a very similar error in my logs during my deployment…
I was using 2.6 and the same deployment worked with out any errors…
Once I upgraded to 3.1 and attempted the same deployment I got the following error…
Method invocation failed because [System.Security.Cryptography.AesCryptoService
Provider] doesn’t contain a method named ‘Dispose’.
+ CategoryInfo : InvalidOperation: (Dispose:String) , RuntimeEx
+ FullyQualifiedErrorId : MethodNotFound
Array assignment to [Octopus.Action[WebServicesDeploy].IISWebSite.ApplicationPo
olPassword] failed: The value “********” is not of type “System.S
tring” and cannot be used in this generic collection.
Parameter name: value…
I ran the above script and this is the output from my Octopus Server.
.Net version: v4.0
Powershell version: 3.0
Output of your script is below:
.Net version: v4.0
Powershell version: 2.0
This error is occurring on Tentacles running PowerShell 2.0. We will look to get a fix out as soon as possible, but in the meantime if you are able to upgrade to PowerShell >= 3.0 on the Tentacle, it should fix the issue.
Sorry for the inconveniences
the server of the tentacle which had the error only had Powershell 2.0 install. I upgraded this to Pwoershell 3.0 and then redeployed and the deployment was successful without any errors.
The release notes for 3.1.1 suggest this may have been fixed:
“2005 - Resolved issue with PowerShell 2.0 and sensitive-variables”
Was this fix related to what we have discussed in this thread? If so, I’ve upgraded to 3.1.1 and I’m still getting the issue on deployments.
The fix was related to what we discussed here, yes. I’ve passed on your comment to the dev that worked on this issue. I’ll keep you posted.