Skip to content

@foreach incorrectly iterates over string characters #11

@wendellmva

Description

@wendellmva

Description

@foreach with IEnumerable cast matches string type, causing iteration over chars instead of treating as error.

Steps to Reproduce

@foreach(var item in Context.Name) {
  Item: ${item}
}

If Context.Name is a string like 'Hello', it iterates H, e, l, l, o.

Solution

Add explicit string check before IEnumerable cast in ProcessForeachBlock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High prioritySP:11 story point (trivial)bugBug fixtemplatesCode templates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions