Adding SwipeItems to a SwipeControl from code-behind throws an AccessViolationException
See original GitHub issueDescribe the bug I have been trying to add a SwipeControl to a StackPanel from a C# code-behind. Doing everything from XAML works as expected, but doing the exact same in C# always throws an AccessViolationException when attempting to add a new SwipeItem to SwipeControl.LeftItems (or any of the other four directions).
I also tried not setting LeftItems in the ‘constructor’ (not sure what it’s called) and not setting it at all. The former resulted in the same error, and the latter threw a NullReferenceException as expected.
Steps to reproduce the bug
var swipeControl = new SwipeControl()
{
LeftItems = new SwipeItems()
{
Mode = SwipeMode.Execute
}
};
swipeControl.LeftItems.Add(new SwipeItem() {
Text = "Dismiss",
IconSource = new SymbolIconSource()
{
Symbol = Symbol.Forward
}
});
Expected behavior WinUI should not throw an AccessViolationException.
Version Info
NuGet package version: Microsoft.UI.Xaml 2.4.2 Microsoft.UI.Xaml 2.5.0-prerelease.200708003
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 |
Additional context
This should be a separate issue, but without native or mixed debugging enabled, the real exception is hidden behind a non-descriptive COM exception. The only information that can be extrapolated from that COM exception is which assembly it’s coming from (which in this case is Microsoft.UI.Xaml)
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)
Top GitHub Comments
This is on my radar but I haven’t had the time to investigate it yet. I’m sorry.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.