Skip to content

Can't bind array to ItemsSource when using C++/WinRT #4119

Open

Description

Describe the bug

When using C++/WinRT, binding to ItemSource using x:Bind doesn't work as it generates a C# style array which won't work in C++, instead use winrt::array_view.

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Define an array in IDL
  2. Bind it to a XAML control
  3. See error

Expected behavior
x:Bind should work with an array

Screenshots

திரைப்பிடிப்பு (247)

Version Info

NuGet package version:

Windows app type:

UWP Win32
Yes No
Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2020 Update (19041) Yes
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Activity

  1. ghost added
    needs-triageIssue needs to be triaged by the area owners
    on Feb 6, 2021
  2. StephenLPeters commented on Feb 9, 2021

    @StephenLPeters
    Contributor

    Kenny Kerr (@kennykerr) FYI, Is this a cppwinrt issue or a xaml compiler issue?

  3. StephenLPeters commented on Feb 9, 2021

    @StephenLPeters
    Contributor
  4. kennykerr commented on Feb 9, 2021

    @kennykerr

    That code is not generated by cppwinrt.

  5. RealTommyKlein commented on Feb 9, 2021

    @RealTommyKlein
    Contributor

    Stephen L Peters (@StephenLPeters) it's an issue in the Xaml compiler's generated code

  6. JeanRoca commented on Mar 10, 2021

    @JeanRoca

    @Jaiganeshkumaran does this issue occur in a Desktop project as well?

  7. JeanRoca commented on Apr 14, 2021

    @JeanRoca

    No further information provided, closing for now. Feel free to reopen if there is more info.

  8. ghost removed
    needs-triageIssue needs to be triaged by the area owners
    on Apr 14, 2021
  9. jgkumaran commented on May 22, 2021

    @jgkumaran
    ContributorAuthor

    No further information provided, closing for now. Feel free to reopen if there is more info.

    Yes this seems to happen in a desktop project as well however only when you use C++. Works fine with C#.

  10. 9 remaining items

  11. jgkumaran commented on Feb 7, 2024

    @jgkumaran
    ContributorAuthor

    @JaiganeshKumaran does this issue occur in a Desktop project as well?

    Yes, it very much does; please fix it soon.

  12. bpulliam commented on Feb 29, 2024

    @bpulliam
    Contributor

    You mentioned that you would like this reopened, so I'm just getting some background. You also mentioned this is a duplicate of #7929, but that issue is closed. Is this not a duplicate, or is that issue closed incorrectly?

  13. jgkumaran commented on Feb 29, 2024

    @jgkumaran
    ContributorAuthor

    Bob Pulliam (@bpulliam) That issue is in fact a duplicate, but the author closed it because this issue was open at that time.

  14. hoshiizumiya commented on Nov 15, 2026

    @hoshiizumiya
    Contributor

    Tommy Klein (@RealTommyKlein) Jesse Collins (@JesseCol) Reopen please. Still reproducible.

  15. github-actions commented on Nov 16, 2026

    @github-actions

    Thank you for taking the time to file this issue and help improve WinUI.

    🧭 Triage summary

    🛠️ For the WinUI team

    🧩 area-Binding, area-C++/WinRT · 👥 team-Core, team-Markup · 🐞 Bug

    Reporter says x:Bind to an IDL-defined array used as ItemsSource fails in C++/WinRT because generated code uses a C#-style array instead of winrt::array_view. Follow-ups report the same failure in a desktop C++ project, and no workaround is mentioned.

    🧪 Investigation details
    • Reproduction: ✅ Sufficient detail for initial investigation
    • Issue Type plan: Set the missing repository Type to Bug.
    • WinUI project priority assessment: P1. Reporter states x:Bind to an IDL-defined array used as ItemsSource fails in C++/WinRT; no workaround is reported. Error text appears only in a screenshot. Follow-up says a desktop C++ project is also affected. Existing project values take precedence; publication requires configured project access.
    • Routing at assessment time (existing labels preserved): area-Binding, area-C++/WinRT, team-Core, team-Markup.
    • Suggested area: area-Binding (high confidence).
    • Routing rationale: Reporter diagnoses x:Bind code generation for ItemsSource arrays as producing C#-style array code that does not work in C++/WinRT, placing the failure at the Binding boundary. Existing area-Binding label retained; diagnosis is unverified.
    • Triage: Maintainer review remains required (needs-triage).

    AI-assisted automated triage; WinUI maintainers make final decisions. Routing above is an assessment-time snapshot; later maintainer label changes take precedence. Existing labels are preserved; this workflow never closes issues automatically.

  16. added
    team-CoreParent label for issues owned by the Reach, Rendering, or Markup teams
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-Bindingarea-C++/WinRTIssues related with C++/WinRT experiencebugSomething isn't workingneeds-triageIssue needs to be triaged by the area ownersteam-CoreParent label for issues owned by the Reach, Rendering, or Markup teamsteam-MarkupIssue for the Markup team

Type

Projects

  • Status
    Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions