microsoft / microsoft/microsoft-ui-xaml

x:Bind with cast fails to compile with C++

Open
#10,360 2 comments 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

Got
```
error C2665: 'winrt::to_hstring': no overloaded function could convert all the argument types
```

The exact same code works in C# project

### Steps to reproduce the bug

1. Create a new winui3 C++ project, use this xaml
```xml


A
B



```
2. Build and observe the compile error

### Expected behavior

_No response_

### Screenshots

_No response_

### NuGet package version

WinUI 3 - Windows App SDK 1.7 Experimental 3: 1.7.250127003-experimental3

### Windows version

Windows 11 (24H2): Build 26100

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

No repository file or test is named. Reproduce the XAML in a WinUI 3 C++ project, then trace the x:Bind cast compilation path and the reported winrt::to_hstring error; done means the sample builds and the cast binding displays the selected item as intended.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.