XpiritBV / Vsts-Build-Task-InlinePowershell

6 stars 8 forks source link

Message "The environment block used to start a process cannot be longer than 65535 bytes" #10

Open eNeRGy164 opened 6 years ago

eNeRGy164 commented 6 years ago

When using this task, and having lot's of environment variables these messages start to surface in the output:

2018-01-29T10:35:23.2380273Z Add-Type : The environment block used to start a process cannot be longer than 65535 bytes.  Your environment block is 
2018-01-29T10:35:23.2380273Z 70210 bytes long.  Remove some environment variables and try again.
2018-01-29T10:35:23.2380273Z At E:\work1\_tasks\InlineAzurePowershell_31f040e5-e040-4336-878a-59a493389784\1.1.6\ps_modules\VstsTaskSdk\LongPathFunc
2018-01-29T10:35:23.2380273Z tions.ps1:212 char:1
2018-01-29T10:35:23.2380273Z + Add-Type -Debug:$false -TypeDefinition @'
2018-01-29T10:35:23.2536407Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-01-29T10:35:23.2536407Z     + CategoryInfo          : NotSpecified: (:) [Add-Type], InvalidOperationException
2018-01-29T10:35:23.2536407Z     + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.AddTypeCommand
2018-01-29T10:35:23.2536407Z  
2018-01-29T10:35:23.3630156Z Add-Type : The environment block used to start a process cannot be longer than 65535 bytes.  Your environment block is 
2018-01-29T10:35:23.3630156Z 70210 bytes long.  Remove some environment variables and try again.
2018-01-29T10:35:23.3630156Z At E:\work1\_tasks\InlineAzurePowershell_31f040e5-e040-4336-878a-59a493389784\1.1.6\ps_modules\VstsTaskSdk\VstsTaskSdk.
2018-01-29T10:35:23.3630156Z psm1:70 char:1
2018-01-29T10:35:23.3630156Z + Add-Type -WarningAction SilentlyContinue -Debug:$false -TypeDefinitio ...
2018-01-29T10:35:23.3630156Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-01-29T10:35:23.3630156Z     + CategoryInfo          : NotSpecified: (:) [Add-Type], InvalidOperationException
2018-01-29T10:35:23.3630156Z     + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.AddTypeCommand
2018-01-29T10:35:23.3630156Z  

This message is fixed by using vsts-task-lib 0.8.2 or newer.

Hopefully you can upgrade the lib.

For reference: https://github.com/Microsoft/vsts-task-lib/issues/228 https://github.com/Microsoft/vsts-tasks/pull/4660

pgroene commented 6 years ago

I'll have a look asap to fix the problem. Thx for reporting

taaariq commented 6 years ago

I've come across the same issue. Hope there is a fix soon :)