Skip to content

CompositeFormat escaping { or } does not work as expected #127794

Closed

Description

Description

Trying to escape { with {{ results in {{, not {.

Reproduction Steps

string compositeFormatResult = string.Format(CultureInfo.InvariantCulture, CompositeFormat.Parse("{{"));
string formatResult = string.Format("{{");
Debug.Assert(compositeFormatResult == formatResult);

Expected behavior

Same as string.Format without using a CompositeFormat.

  • {{ results in {.
  • }} results in }.

Actual behavior

  • {{ results in {{.
  • }} results in }}.

Regression?

Seems to also happen in .NET 8 and .NET 9
CompositeFormat was introduced in .NET 8

Known Workarounds

No response

Configuration

  • .Net Version: 10.0.107
  • OS: Windows 11
  • Architecture: x64

Other information

No response

Activity

  1. added
    untriaged
    on May 5, 2026
  2. dotnet-policy-service commented on May 5, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-globalization
    See info in area-owners.md if you want to be subscribed.

  3. dotnet-policy-service commented on May 5, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-runtime
    See info in area-owners.md if you want to be subscribed.

  4. tarekgh commented on May 5, 2026

    @tarekgh
    Member
  5. added this to the 11.0.0 milestone on May 5, 2026
  6. removed
    untriaged
    on May 5, 2026
  7. locked and limited conversation to collaborators on Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions