question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SqlDacpacDeploymentOnMachineGroupV0 - environment variable size failure

See original GitHub issue

Related to: https://github.com/microsoft/azure-pipelines-extensions/issues/709 PR: https://github.com/microsoft/azure-pipelines-extensions/pull/710

SqlDacpacDeploymentOnMachineGroupV0 - 0.3.20 is using an older version of vstasksdk (0.8.2) resulting in System.InvalidOperationException: The environment block used to start a process cannot be longer than 65535 bytes. Your environment block is 69981 bytes long. Remove some environment variables and try again. when using a large number (50) of builds

If I replace ps_modules\VsTaskSdk(0.8.2) with the ps_modules\VsTaskSdk (0.11.0) from _tasks\Powershell(2.151.2)

and remove Add-Type from TaskModuleSqlUtility.psm1 (https://github.com/microsoft/azure-pipelines-extensions/blob/master/TaskModules/powershell/TaskModuleSqlUtility/TaskModuleSqlUtility.psm1)

the error goes way

Type: Bug

Enter Task Name: https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/SqlDacpacDeploymentOnMachineGroupV0

Environment

  • Server - Azure Pipelines

https://dev.azure.com/raulandborg/Enterprise releaseId=233

  • Agent - Private:

agent.version:2.158.0 agent.os:Windows_NT agent.osarchitecture:x64 agent.osversion:6.3.9600

Issue Description

[error]The environment block used to start a process cannot be longer than 65535 bytes. Your environment block is 69981 bytes long. Remove some environment variables and try again.

Task logs

2019-10-22T22:01:12.4806611Z ##[debug]Loading module from path 'C:\azagent\A1\_work\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.20\ps_modules\TaskModuleSqlUtility\TaskModuleSqlUtility.psd1'.
2019-10-22T22:01:12.4924371Z ##[debug]Loading module from path 'C:\azagent\A1\_work\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.20\ps_modules\TaskModuleSqlUtility\TaskModuleSqlUtility.psm1'.
2019-10-22T22:01:12.5302331Z ##[debug]NonInteractive: False
2019-10-22T22:01:12.6247888Z ##[debug]Exporting function 'Invoke-DacpacDeployment'.
2019-10-22T22:01:12.6297345Z ##[debug]Exporting function 'Invoke-SqlQueryDeployment'.
2019-10-22T22:01:12.6354879Z ##[debug]Adding exceptions types.
2019-10-22T22:01:12.8405840Z ##[debug]Caught exception from task script.
2019-10-22T22:01:12.8460442Z ##[debug]Error record:
2019-10-22T22:01:13.0209589Z ##[debug]Add-Type : The environment block used to start a process cannot be longer than 65535 bytes.  Your environment block is 69981 bytes long.  Remove some environment variables and try again.
2019-10-22T22:01:13.0253086Z ##[debug]At C:\azagent\A1\_work\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.20\ps_modules\TaskModuleSqlUtility\TaskModuleSqlUtility.psm1:28 char:1
2019-10-22T22:01:13.0291491Z ##[debug]+ Add-Type -WarningAction SilentlyContinue -Debug:$false -TypeDefinitio ...
2019-10-22T22:01:13.0329949Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-10-22T22:01:13.0367923Z ##[debug]    + CategoryInfo          : NotSpecified: (:) [Add-Type], InvalidOperationEx    ception
2019-10-22T22:01:13.0412881Z ##[debug]    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Power    Shell.Commands.AddTypeCommand
2019-10-22T22:01:13.0451396Z ##[debug] 
2019-10-22T22:01:13.0518406Z ##[debug]Script stack trace:
2019-10-22T22:01:13.0633754Z ##[debug]at <ScriptBlock>, C:\azagent\A1\_work\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.20\ps_modules\TaskModuleSqlUtility\TaskModuleSqlUtility.psm1: line 28
2019-10-22T22:01:13.0671795Z ##[debug]at <ScriptBlock>, C:\azagent\A1\_work\_tasks\SqlDacpacDeploymentOnMachineGroup_4b506f7f-720f-47bb-bf21-029bac6a690d\0.3.20\Main.ps1: line 83
2019-10-22T22:01:13.0714939Z ##[debug]at <ScriptBlock>, <No file>: line 1
2019-10-22T22:01:13.0754792Z ##[debug]at <ScriptBlock>, <No file>: line 22
2019-10-22T22:01:13.0793196Z ##[debug]at <ScriptBlock>, <No file>: line 18
2019-10-22T22:01:13.0833300Z ##[debug]at <ScriptBlock>, <No file>: line 1
2019-10-22T22:01:13.0903951Z ##[debug]Exception:
2019-10-22T22:01:13.1035571Z ##[debug]System.InvalidOperationException: The environment block used to start a process cannot be longer than 65535 bytes.  Your environment block is 69981 bytes long.  Remove some environment variables and try again.
2019-10-22T22:01:13.1075452Z ##[debug]   at System.Diagnostics.EnvironmentBlock.ToByteArray(StringDictionary sd, Boolean unicode)
2019-10-22T22:01:13.1116420Z ##[debug]   at System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine)
2019-10-22T22:01:13.1158493Z ##[debug]   at System.CodeDom.Compiler.Executor.ExecWaitWithCapture(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine)
2019-10-22T22:01:13.1200267Z ##[debug]   at Microsoft.CSharp.CSharpCodeGenerator.Compile(CompilerParameters options, String compilerDirectory, String compilerExe, String arguments, String& outputFile, Int32& nativeReturnValue, String trueArgs)
2019-10-22T22:01:13.1240437Z ##[debug]   at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
2019-10-22T22:01:13.1278725Z ##[debug]   at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
2019-10-22T22:01:13.1321693Z ##[debug]   at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
2019-10-22T22:01:13.1364265Z ##[debug]   at Microsoft.PowerShell.Commands.AddTypeCommand.CompileAssemblyFromSource(List`1 generatedTypes)
2019-10-22T22:01:13.1405191Z ##[debug]   at Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()
2019-10-22T22:01:13.1448472Z ##[debug]   at System.Management.Automation.CommandProcessorBase.Complete()

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
20shivangicommented, Sep 21, 2020

Great, closing it now 😃

1reaction
FlorisDevreesecommented, Sep 21, 2020

@20shivangi Yes, we are unblocked 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

when i was installing oracle database i get the following error ...
Restart the installer after correcting the setting for environment variable. the length of the existing PATH environmental variable is too long.
Read more >
Understand the Lambda environment variable size quota - AWS
I want to configure more than 4 KB of environment variables for my AWS Lambda function. How do I increase my service quota...
Read more >
How do I work around Vercel's 64KB Environment Variables ...
The maximum allowed size of Environment Variables for a Deployment is 64KB and cannot be increased. This article provides a workaround by encrypting...
Read more >
Limitations on environment variables - IBM
The maximum size of this block is 32K. If the block of environment variables is greater than 32K, the error -1832 is returned...
Read more >
SetFirmwareEnvironmentVariabl...
The size of the pBuffer buffer, in bytes. If this parameter is zero, the firmware environment variable is deleted.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found