Skip to content

Fix local deploy compilation for large module templates#19754

Merged
anthony-c-martin merged 6 commits into
Azure:mainfrom
GABRIELNGBTUC:feature/fix-19750
Jun 30, 2026
Merged

Fix local deploy compilation for large module templates#19754
anthony-c-martin merged 6 commits into
Azure:mainfrom
GABRIELNGBTUC:feature/fix-19750

Conversation

@GABRIELNGBTUC

@GABRIELNGBTUC GABRIELNGBTUC commented May 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #19750

Description

Removes the 132k characters limit for compiled modules in local deploys by using the JSON writer instead of the text writer.

Tested against a production bicep file blocked by this issue and no side effects have been noticed.

Checklist

When `targetScope = 'local'`, module `properties.template` was emitted via
`EmitProperty(string, string)`, which serialized it as an ARM expression
string literal and hit the 131072-character literal limit for large modules.

This change emits the nested module template as a plain JSON string value in
`TemplateWriter.EmitModuleForLocalDeploy`, avoiding expression literal
serialization and preventing the internal `ExpressionException`.

Also adds regression test `Test_Issue19750` in `ScenarioTests` to verify
large local module templates compile successfully and are emitted as valid
JSON string content.
@GABRIELNGBTUC GABRIELNGBTUC marked this pull request as ready for review May 29, 2026 12:18
Comment thread src/Bicep.Core/Emit/TemplateWriter.cs Outdated

@anthony-c-martin anthony-c-martin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See suggested fix

@anthony-c-martin anthony-c-martin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@anthony-c-martin anthony-c-martin merged commit c2029f4 into Azure:main Jun 30, 2026
41 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Test this change out locally with the following install scripts (Action run 28413748873)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 28413748873
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 28413748873"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 28413748873
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 28413748873"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local deploy cannot compile files with modules compiling to more than 131k characters

2 participants