Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[X] fix CollectionItems enumeration #17364

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Controls/src/Xaml/XamlNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public override void Accept(IXamlNodeVisitor visitor, INode parentNode)
{
foreach (var node in Properties.Values.ToList())
node.Accept(visitor, this);
foreach (var node in CollectionItems)
foreach (var node in CollectionItems.ToList())
node.Accept(visitor, this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Test
#if DEBUG
[SetUp] public void Setup() => AppInfo.SetCurrent(new MockAppInfo());
[TearDown] public void TearDown() => AppInfo.SetCurrent(null);

[Test]
public void GetsourceInfo([Values(false)] bool useCompiledXaml)
{
Expand Down
17 changes: 17 additions & 0 deletions src/Controls/tests/Xaml.UnitTests/Issues/Maui17333.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Microsoft.Maui.Controls.Xaml.UnitTests.Maui17333">

<OnPlatform x:TypeArguments="x:String"
x:Key="RegularFont"
Default="OpenSansRegular"
/>

<OnPlatform x:TypeArguments="x:String"
x:Key="BoldFont"
Default="OpenSansSemiBold"
/>

</ResourceDictionary>
39 changes: 39 additions & 0 deletions src/Controls/tests/Xaml.UnitTests/Issues/Maui17333.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System;
using Microsoft.Maui.ApplicationModel;
using Microsoft.Maui.Controls.Core.UnitTests;
using Microsoft.Maui.Controls.Shapes;
using Microsoft.Maui.Devices;
using Microsoft.Maui.Graphics;
using NUnit.Framework;

namespace Microsoft.Maui.Controls.Xaml.UnitTests;

public partial class Maui17333 : ResourceDictionary
{

public Maui17333() => InitializeComponent();

public Maui17333(bool useCompiledXaml)
{
//this stub will be replaced at compile time
}

[TestFixture]
class Test
{
[SetUp] public void Setup() => AppInfo.SetCurrent(new MockAppInfo());
[TearDown] public void TearDown() => AppInfo.SetCurrent(null);

[Test]
public void CompilerDoesntThrowOnOnPlatform([Values(true)] bool useCompiledXaml)
{
if (useCompiledXaml)
{
MockCompiler.Compile(typeof(Maui17333),targetFramework: "net-ios");
}
}
}
}
Loading