From f4126e713396fc514d96be91672e3cf575a16293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Su=C3=A1rez?= Date: Wed, 20 Nov 2024 15:59:42 +0100 Subject: [PATCH 01/10] Added repro sample --- .../TestCases.HostApp/Issues/Issue25893.xaml | 16 ++++++++++++++++ .../TestCases.HostApp/Issues/Issue25893.xaml.cs | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml.cs diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml new file mode 100644 index 000000000000..e51d847fb67f --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml.cs new file mode 100644 index 000000000000..9ff3cb8d59c0 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml.cs @@ -0,0 +1,17 @@ +namespace Maui.Controls.Sample.Issues +{ + + [Issue(IssueTracker.Github, 25893, "Setting MenuFlyoutSubItem IconImageSource throws a NullReferenceException", PlatformAffected.UWP)] + public partial class Issue25893 : TestContentPage + { + public Issue25893() + { + InitializeComponent(); + } + + protected override void Init() + { + + } + } +} \ No newline at end of file From f04642853824096733f9165ca205e69eeea8083c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Su=C3=A1rez?= Date: Thu, 21 Nov 2024 12:43:19 +0100 Subject: [PATCH 02/10] Updated sample --- src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml index e51d847fb67f..0f84558caecb 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml @@ -8,7 +8,7 @@ - + From 0da244f08c41dfb2dd59a79a3bf64dd48cdb8c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Su=C3=A1rez?= Date: Thu, 21 Nov 2024 12:43:26 +0100 Subject: [PATCH 03/10] Fix the issue --- src/Controls/src/Core/Menu/MenuFlyoutSubItem.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Controls/src/Core/Menu/MenuFlyoutSubItem.cs b/src/Controls/src/Core/Menu/MenuFlyoutSubItem.cs index 3f606a85523c..d92d506a3010 100644 --- a/src/Controls/src/Core/Menu/MenuFlyoutSubItem.cs +++ b/src/Controls/src/Core/Menu/MenuFlyoutSubItem.cs @@ -16,7 +16,12 @@ public partial class MenuFlyoutSubItem : MenuFlyoutItem, IMenuFlyoutSubItem public MenuFlyoutSubItem() { - LogicalChildrenInternalBackingStore = new CastingList(_menus); + LogicalChildrenInternalBackingStore = new List(); + + foreach(var item in _menus) + { + LogicalChildrenInternalBackingStore.Add((Element)item); + } } private protected override IList LogicalChildrenInternalBackingStore { get; } From c9661232e10bb438ff033f4824f00be830ac1e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Su=C3=A1rez?= Date: Thu, 21 Nov 2024 12:56:47 +0100 Subject: [PATCH 04/10] Added UITest --- .../TestCases.HostApp/Issues/Issue25893.xaml | 3 ++- .../Tests/Issues/Issue25893.cs | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25893.cs diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml index 0f84558caecb..fb3860f05def 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue25893.xaml @@ -4,7 +4,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Maui.Controls.Sample.Issues.Issue25893"> - +