Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public IEnumerable<Instruction> ProvideValue(VariableDefinitionReference vardefr
&& xKeyNode is ValueNode xKeyValueNode
&& xKeyValueNode.Value as string == keyValueNode.Value as string)
{
if (context.Variables[resourcesNode as IElementNode].VariableType.FullName == "System.String")
if (context.Variables[irn].VariableType.FullName == "System.String")
{
foreach (var instruction in TryConvert(irn.CollectionItems[0] as ValueNode, eNode, vardefref, module, context))
yield return instruction;
Expand All @@ -56,9 +56,9 @@ public IEnumerable<Instruction> ProvideValue(VariableDefinitionReference vardefr
&& xKeyNode2 is ValueNode xKeyValueNode2
&& xKeyValueNode2.Value as string == keyValueNode.Value as string)
{
if (irn2.CollectionItems.Count == 1 && irn2.CollectionItems[0] is ValueNode vn2 && vn2.Value is string)
if (context.Variables[irn2].VariableType.FullName == "System.String")
{
foreach (var instruction in TryConvert(vn2, eNode, vardefref, module, context))
foreach (var instruction in TryConvert(irn2.CollectionItems[0] as ValueNode, eNode, vardefref, module, context))
yield return instruction;
yield break;
}
Expand All @@ -81,9 +81,9 @@ public IEnumerable<Instruction> ProvideValue(VariableDefinitionReference vardefr
&& xKeyNode3 is ValueNode xKeyValueNode3
&& xKeyValueNode3.Value as string == keyValueNode.Value as string)
{
if (irn3.CollectionItems.Count == 1 && irn3.CollectionItems[0] is ValueNode vn3 && vn3.Value is string)
if (context.Variables[irn3].VariableType.FullName == "System.String")
{
foreach (var instruction in TryConvert(vn3, eNode, vardefref, module, context))
foreach (var instruction in TryConvert(irn3.CollectionItems[0] as ValueNode, eNode, vardefref, module, context))
yield return instruction;
yield break;
}
Expand Down
12 changes: 12 additions & 0 deletions src/Controls/tests/Xaml.UnitTests/Issues/Maui26206.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Microsoft.Maui.Controls.Xaml.UnitTests.Maui26206"
Title="Maui26206">
<ContentPage.Resources>
<x:Double x:Key="ResourceOne">25</x:Double>
<x:Double x:Key="ResourceTwo">185</x:Double>
</ContentPage.Resources>
<VerticalStackLayout Spacing="{StaticResource ResourceOne}">
</VerticalStackLayout>
</ContentPage>
46 changes: 46 additions & 0 deletions src/Controls/tests/Xaml.UnitTests/Issues/Maui26206.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Microsoft.Maui.ApplicationModel;
using Microsoft.Maui.Controls.Core.UnitTests;
using Microsoft.Maui.Dispatching;
using Microsoft.Maui.UnitTests;
using NUnit.Framework;

namespace Microsoft.Maui.Controls.Xaml.UnitTests;

public partial class Maui26206 : ContentPage
{
public Maui26206()
{
InitializeComponent();
}

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

[TestFixture]
class Test
{
[SetUp]
public void Setup()
{
Application.SetCurrentApplication(new MockApplication());
DispatcherProvider.SetCurrent(new DispatcherProviderStub());
}

[TearDown]
public void TearDown()
{
AppInfo.SetCurrent(null);
}

[Test]
public void MultipleResourcesInRD([Values]bool useCompiledXaml)
{
if (useCompiledXaml)
MockCompiler.Compile(typeof(Maui26206));
var page = new Maui26206(useCompiledXaml);
Assert.That(((StackBase)page.Content).Spacing, Is.EqualTo(25d));
}
}
}