microsoft / microsoft/microsoft-ui-xaml
Binding properties of type `Thickness` in `Resource` crashes the app
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
Binding properties of type `Thickness`, like `Margin` and `Padding` in `Resource` will cause the app to crash. The crash happens before the getter of the binding is even called.
I thought it might be unsupported, but using the same way to bind `Color` does work. So there might be an issue here.
### Steps to reproduce the bug
1. Create a new WinUI3 C++ packaged project
2. In `MainWindow.xaml`, use this xaml
```xml
<Setter Property="Margin" Value="{x:Bind MyPadding, Mode=OneWay}" />
Click Me
```
3. In code-behind, return random values for the binding
```cpp
winrt::Microsoft::UI::Xaml::Thickness MyPadding() { return {1,2,3,4}; }
```
### Expected behavior
_No response_
### Screenshots

### NuGet package version
WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002
### Windows version
Windows 11 (22H2): Build 22621
### Additional context

[Repro](https://github.com/HO-COOH/WinUI-Bug/tree/main/20-BindingThicknessInResourceCrash)
Contributor guide
Research direction
Start by running the repro in 20-BindingThicknessInResourceCrash and inspect MainWindow.xaml together with its code-behind. Confirm whether the crash occurs when the Thickness-valued x:Bind is used in the Resource style, compare it with the working Color binding, and document the result as the completion criterion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100