Skip to content

Multi-architecture container publishing truncates environment variable values containing colons #57146

Open

Description

@kaedai1O

Describe the bug

.NET SDK multi-architecture container publishing silently truncates custom ContainerEnvironmentVariable values at the first colon. Publishing succeeds, but the resulting images contain incorrect configuration.

For example, ASPNETCORE_URLS=http://+:8080 becomes ASPNETCORE_URLS=http, causing ASP.NET Core startup to fail:

System.FormatException: Invalid url: 'http'

Steps to reproduce

Add these settings to an ASP.NET Core project:

<PropertyGroup>
  <RuntimeIdentifiers>linux-x64;linux-arm64</RuntimeIdentifiers>
  <ContainerRuntimeIdentifiers>linux-x64;linux-arm64</ContainerRuntimeIdentifiers>
</PropertyGroup>

<ItemGroup>
  <ContainerEnvironmentVariable
    Include="ASPNETCORE_URLS"
    Value="http://+:8080" />
</ItemGroup>

Publish a multi-architecture container archive:

dotnet publish --configuration Release \
  /t:PublishContainer \
  -p:ContainerArchiveOutputPath=./image.tar

Expected behavior

Inspect the environment variables in both platform images.

Expected: ASPNETCORE_URLS=http://+:8080

Actual behavior

Inspect the environment variables in both platform images.

Actual: ASPNETCORE_URLS=http

Is this a regression?

No response

Are there any workarounds?

No response

dotnet --info output

IDE version

No response

Other details

  • Observed in actual amd64 and arm64 images published with SDK 11.0.100.
  • Reproduced the serialization/reconstruction behavior with an offline MSBuild probe using SDK 10.0.300.
  • The previous single-architecture publish preserved the URL.
  • %3A escaping still results in truncation; double escaping leaves encoded text instead of the literal URL.
  • Custom container labels appear to use similar parsing and may also be affected.

Suspected cause

The multi-RID publishing targets serialize environment variables as Identity:Value, then reconstruct the value using Split(':')[1]. Any additional colons in the value are discarded.

Relevant SDK source:

Activity

  1. added
    untriaged
    on Nov 16, 2026
  2. locked and limited conversation to collaborators on Nov 16, 2026
  3. unlocked this conversation on Nov 16, 2026
  4. added
    Area-Containers
    cookie
    and removed
    untriaged
    on Nov 16, 2026
  5. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    🎯 Agentic Issue Triage

    Triage Assessment:

    • 🏷️ Labels: Area-Containers Related to dotnet SDK containers functionality Bug cookie Issue Monster Loves Cookies!
    • 💻 Assignment: @mthalman | @dotnet/sdk-container-builds-maintainers
    • 🟩 Confidence: high - The issue directly identifies container publishing targets and the Containers CODEOWNERS section is unambiguous.

    ➡️ Summary: Multi-RID container publishing truncates ContainerEnvironmentVariable values at the first colon, e.g. ASPNETCORE_URLS becomes "http". Fix the serialization/reconstruction in Microsoft.NET.Build.Containers.targets to preserve additional colons.

    Generated by 🏷️ Issue Triage for #57146 · copilot · auto · ~14 AIC · ⌖ ~1 AIC · ⊞ 14.6K · ◷

  6. github-actions commented on Nov 17, 2026

    @github-actions
    Contributor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster Orchestrator · copilot · auto (Claude Sonnet 5.5) · ~13 AIC · ⌖ ~29 AIC · ⊞ 13K · ◷

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

Metadata

Metadata

Labels

Area-ContainersBugcookie

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions