WindowsCommunityToolkit
WindowsCommunityToolkit copied to clipboard
TokenizingTextBox crashes the app in CommunityToolkit.WinUI
Describe the bug
Having an TokenizingTextBox
in WinUI crashes the app. The same code works well in UWP.
<Grid>
<controls:TokenizingTextBox />
</StackPanel>
Regression
No response
Reproducible in sample app?
- [ ] This bug can be reproduced in the sample app.
Steps to reproduce
1. Create a WinUI3 project
2. Add the snippet from the bug description
3. Run the app
Expected behavior
The app will continue running and show the items from TokenizingTextBox as with a normal one would.
Screenshots
No response
Windows Build Number
- [ ] Windows 10 1809 (Build 17763)
- [ ] Windows 10 1903 (Build 18362)
- [ ] Windows 10 1909 (Build 18363)
- [ ] Windows 10 2004 (Build 19041)
- [ ] Windows 10 20H2 (Build 19042)
- [ ] Windows 10 21H1 (Build 19043)
- [X] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)
Other Windows Build number
No response
App minimum and target SDK version
- [X] Windows 10, version 1809 (Build 17763)
- [ ] Windows 10, version 1903 (Build 18362)
- [ ] Windows 10, version 1909 (Build 18363)
- [ ] Windows 10, version 2004 (Build 19041)
- [ ] Other (specify)
Other SDK version
No response
Visual Studio Version
2022
Visual Studio Build Number
17.3.3
Device form factor
Desktop
Nuget packages
- CommunityToolkit.WinUI.UI : 7.1.2
- CommunityToolkit.WinUI.UI.Controls : 7.1.2
- CommunityToolkit.WinUI.UI.Controls.Input : 7.1.2
- Microsoft.WindowsAppSDK : 1.1.3
- Microsoft.Windows.SDK.BuildTools : 10.0.22000.194
Additional context
Help us help you
Yes, but only if others can assist.
Hello lunelake, thank you for opening an issue with us!
I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌
Able to reproduce. Stacktrace:
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr) at Microsoft.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize) at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize) at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)
What's strange is that this only seems to happen when the Orientation of the parent StackPanel is explicitly set to Horizontal.
This causes a crash:
<StackPanel Orientation="Horizontal">
<controls:TokenizingTextBox />
</StackPanel>
But when left out, or set to Vertical, it does not crash:
<StackPanel Orientation="Vertical">
<controls:TokenizingTextBox />
</StackPanel>
Able to reproduce this in UWP as well, seems to be an issue with the WrapPanel:
<StackPanel Orientation="Horizontal">
<local:WrapPanel StretchChild="Last">
<TextBox />
</local:WrapPanel>
</StackPanel>
The app crashes when the Size gets returned in the MeasureOverride function - is it because the width is considered Infinity?
Going to move to 8.0 when we can better test this component in our new infrastructure.