Skip to content

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

@eNeRGy164

Description

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:
microsoft/azure-pipelines-task-lib#228
microsoft/azure-pipelines-tasks#4660

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions