diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/DependencyObjectGeneratorTests/Given_DependencyObjectGenerator.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/DependencyObjectGeneratorTests/Given_DependencyObjectGenerator.cs
index d0b5ac652ef3..0f29ef6dbd5a 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/DependencyObjectGeneratorTests/Given_DependencyObjectGenerator.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/DependencyObjectGeneratorTests/Given_DependencyObjectGenerator.cs
@@ -16,8 +16,8 @@ namespace Uno.UI.SourceGenerators.Tests.DependencyObjectGeneratorTests;
[TestClass]
public class Given_DependencyObjectGenerator
{
- private static readonly ReferenceAssemblies _net80Android = ReferenceAssemblies.Net.Net80Android.AddPackages([new PackageIdentity("Uno.Diagnostics.Eventing", "2.1.0")]);
- private static readonly ReferenceAssemblies _net80 = ReferenceAssemblies.Net.Net80.AddPackages([new PackageIdentity("Uno.Diagnostics.Eventing", "2.1.0")]);
+ private static readonly ReferenceAssemblies _refAsmAndroid = _Dotnet.CurrentAndroid.ReferenceAssemblies.AddPackages([new PackageIdentity("Uno.Diagnostics.Eventing", "2.1.0")]);
+ private static readonly ReferenceAssemblies _refAsm = _Dotnet.Current.ReferenceAssemblies.AddPackages([new PackageIdentity("Uno.Diagnostics.Eventing", "2.1.0")]);
private const string Configuration =
#if DEBUG
@@ -26,16 +26,25 @@ public class Given_DependencyObjectGenerator
"Release";
#endif
- private const string TFM = "net8.0";
+ private const string TFMPrevious = "net8.0";
+ private const string TFMCurrent = "net9.0";
private static MetadataReference[] BuildUnoReferences(bool isAndroid)
{
string[] availableTargets = isAndroid
- ? [Path.Combine("Uno.UI.netcoremobile", Configuration, $"{TFM}-android")]
+ ? [
+ Path.Combine("Uno.UI.netcoremobile", Configuration, $"{TFMPrevious}-android"),
+ Path.Combine("Uno.UI.netcoremobile", Configuration, $"{TFMCurrent}-android"),
+ ]
: [
- Path.Combine("Uno.UI.Skia", Configuration, TFM),
- Path.Combine("Uno.UI.Reference", Configuration, TFM),
- Path.Combine("Uno.UI.Tests", Configuration, TFM),
+ // On CI the test assemblies set must be first, as it contains all
+ // dependent assemblies, which the other platforms don't (see DisablePrivateProjectReference).
+ Path.Combine("Uno.UI.Tests", Configuration, TFMPrevious),
+ Path.Combine("Uno.UI.Reference", Configuration, TFMPrevious),
+ Path.Combine("Uno.UI.Skia", Configuration, TFMPrevious),
+ Path.Combine("Uno.UI.Tests", Configuration, TFMCurrent),
+ Path.Combine("Uno.UI.Reference", Configuration, TFMCurrent),
+ Path.Combine("Uno.UI.Skia", Configuration, TFMCurrent),
];
var unoUIBase = Path.Combine(
@@ -70,7 +79,7 @@ private async Task TestAndroid(string testCode, params DiagnosticResult[] expect
{
Sources = { testCode },
},
- ReferenceAssemblies = _net80Android,
+ ReferenceAssemblies = _refAsmAndroid,
};
test.TestState.AdditionalReferences.AddRange(BuildUnoReferences(isAndroid: true));
@@ -81,7 +90,7 @@ private async Task TestAndroid(string testCode, params DiagnosticResult[] expect
[TestMethod]
public async Task TestAndroidViewImplementingDependencyObject()
{
- await TestAndroid("""
+ var source = """
using Android.Content;
using Windows.UI.Core;
using Microsoft.UI.Dispatching;
@@ -92,7 +101,7 @@ public class C : Android.Views.View, DependencyObject
public C(Context context) : base(context)
{
}
-
+
public CoreDispatcher Dispatcher { get; }
public DispatcherQueue DispatcherQueue { get; }
public object GetValue(DependencyProperty dp) => null;
@@ -103,9 +112,12 @@ public void ClearValue(DependencyProperty dp) { }
public long RegisterPropertyChangedCallback(DependencyProperty dp, DependencyPropertyChangedCallback callback) => 0;
public void UnregisterPropertyChangedCallback(DependencyProperty dp, long token) { }
}
- """,
- // /0/Test0.cs(5,14): error Uno0003: 'Android.Views.View' shouldn't implement 'DependencyObject'. Inherit 'FrameworkElement' instead.
- DiagnosticResult.CompilerError("Uno0003").WithSpan(6, 14, 6, 15).WithArguments("Android.Views.View"));
+ """;
+
+ await TestAndroid(
+ source,
+ // /0/Test0.cs(5,14): error Uno0003: 'Android.Views.View' shouldn't implement 'DependencyObject'. Inherit 'FrameworkElement' instead.
+ DiagnosticResult.CompilerError("Uno0003").WithSpan(6, 14, 6, 15).WithArguments("Android.Views.View"));
}
[TestMethod]
@@ -341,7 +353,7 @@ public void SuspendBindings() =>
""", Encoding.UTF8)) }
}
},
- ReferenceAssemblies = _net80,
+ ReferenceAssemblies = _refAsm,
};
test.TestState.AdditionalReferences.AddRange(BuildUnoReferences(isAndroid: false));
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/DependencyPropertyGeneratorTests/Given_DependencyPropertyGenerator.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/DependencyPropertyGeneratorTests/Given_DependencyPropertyGenerator.cs
index 91c6894298cb..117a75dd2674 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/DependencyPropertyGeneratorTests/Given_DependencyPropertyGenerator.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/DependencyPropertyGeneratorTests/Given_DependencyPropertyGenerator.cs
@@ -124,7 +124,7 @@ partial class Owner
}
}
},
- ReferenceAssemblies = ReferenceAssemblies.Net.Net80.AddPackages(ImmutableArray.Create(new PackageIdentity("Uno.WinUI", "5.0.118"))),
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
};
await test.RunAsync();
@@ -251,7 +251,7 @@ partial class Owner
}
}
},
- ReferenceAssemblies = ReferenceAssemblies.Net.Net80.AddPackages(ImmutableArray.Create(new PackageIdentity("Uno.WinUI", "5.0.118"))),
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
};
await test.RunAsync();
@@ -376,7 +376,7 @@ private static void OnMyValueBackingFieldUpdate(object instance, object newValue
}
}
},
- ReferenceAssemblies = ReferenceAssemblies.Net.Net80.AddPackages(ImmutableArray.Create(new PackageIdentity("Uno.WinUI", "5.0.118"))),
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
};
test.ExpectedDiagnostics.Add(
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/ImplementedRoutedEventsGeneratorTests/Given_ImplementedRoutedEventsGenerator.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/ImplementedRoutedEventsGeneratorTests/Given_ImplementedRoutedEventsGenerator.cs
index aa2a31423661..580edb09ab67 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/ImplementedRoutedEventsGeneratorTests/Given_ImplementedRoutedEventsGenerator.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/ImplementedRoutedEventsGeneratorTests/Given_ImplementedRoutedEventsGenerator.cs
@@ -12,7 +12,7 @@ namespace Uno.UI.SourceGenerators.Tests.ImplementedRoutedEventsGeneratorTests
[TestClass]
public class Given_ImplementedRoutedEventsGenerator
{
- private static readonly ReferenceAssemblies s_defaultWithUno = ReferenceAssemblies.Net.Net80.AddPackages(
+ private static readonly ReferenceAssemblies s_defaultWithUno = _Dotnet.Current.ReferenceAssemblies.AddPackages(
ImmutableArray.Create(new PackageIdentity("Uno.WinUI", "5.0.118")));
private async Task TestGeneratorAsync(string inputSource, params GeneratedFile[] generatedFiles)
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Given_HotReloadService.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Given_HotReloadService.cs
index 90cd7c6ca69a..bb5ba0926b45 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Given_HotReloadService.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Given_HotReloadService.cs
@@ -1,17 +1,6 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
-using System.Runtime.Serialization;
-using System.Security.Cryptography;
-using System.Text;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
-using Microsoft.VisualStudio.TestPlatform.Utilities;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Uno.Extensions;
-using Uno.UI.RemoteControl.Host.HotReload.MetadataUpdates;
using Uno.UI.SourceGenerators.MetadataUpdates;
namespace Uno.UI.SourceGenerators.Tests.MetadataUpdateTests;
@@ -25,9 +14,15 @@ public async Task HR(string name, Scenario? scenario, Project[]? projects)
{
if (scenario != null)
{
+ if (scenario.IsCrashingRoslyn)
+ {
+ Assert.Inconclusive("Case is known to crash roslyn.");
+ return;
+ }
+
var results = await ApplyScenario(projects, scenario.IsDebug, scenario.IsMono, scenario.UseXamlReaderReload, name);
- for (int i = 0; i < scenario.PassResults.Length; i++)
+ for (var i = 0; i < scenario.PassResults.Length; i++)
{
var resultValidation = scenario.PassResults[i];
@@ -47,7 +42,7 @@ public record ScenariosDescriptor(
public record Project(string Name, ProjectReference[]? ProjectReferences);
public record ProjectReference(string Name);
- public record Scenario(bool IsDebug, bool IsMono, bool UseXamlReaderReload, params PassResult[] PassResults)
+ public record Scenario(bool IsDebug, bool IsMono, bool IsCrashingRoslyn, bool UseXamlReaderReload, params PassResult[] PassResults)
{
public override string ToString()
=> $"{(IsDebug ? "Debug" : "Release")},{(IsMono ? "MonoVM" : "NetCore")},XR:{UseXamlReaderReload}";
@@ -63,6 +58,13 @@ public record DiagnosticsResult(string Id);
var scenarioName = Path.GetFileName(scenarioFolder);
var path = Path.Combine(scenarioFolder, "Scenario.json");
+#if DEBUG && false
+ if (!path.Contains("When_DataTemplate_xLoad_xBind_Remove"))
+ {
+ continue;
+ }
+#endif
+
if (File.Exists(path))
{
var scenariosDescriptor = ReadScenarioConfig(path);
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..f8d477b0e53d
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/0/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/0/p1/MainPage.xaml.cs
similarity index 100%
rename from src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/0/p1/MainPage.xaml.cs
rename to src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/0/p1/MainPage.xaml.cs
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..12f069f9c962
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/1/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..53901f90f5a2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/1/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public void OnClick()
+ {
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/Scenario.json
similarity index 51%
rename from src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/Scenario.json
rename to src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/Scenario.json
index b47b1f7a5ffb..902d6383b5fd 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/Scenario.json
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add/Scenario.json
@@ -15,11 +15,8 @@
"IsMono": true,
"PassResults": [
{
- "MetadataUpdates": 0,
- "Diagnostics": [
- // MainPage_c2bc688a73eab5431d787dcd21fe32b9.cs(68,83): error ENC0049: Ceasing to capture variable '__that' requires restarting the application.
- { "Id": "ENC0049" }
- ]
+ "MetadataUpdates": 1,
+ "Diagnostics": []
}
]
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..f8d477b0e53d
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..12f069f9c962
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..53901f90f5a2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public void OnClick()
+ {
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/2/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/2/p1/MainPage.xaml
new file mode 100644
index 000000000000..f8d477b0e53d
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/2/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/2/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/2/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/2/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Add_Remove/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..12f069f9c962
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..53901f90f5a2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public void OnClick()
+ {
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..f8d477b0e53d
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Remove/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..12f069f9c962
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/0/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..53901f90f5a2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/0/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public void OnClick()
+ {
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..e4505d04d75f
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/1/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..d8a2110cb7c9
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/1/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public void OnClick2()
+ {
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xBind_Event_Update/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..f8d477b0e53d
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/0/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/0/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..cf3437687c26
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/1/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..95c6a7795388
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/1/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public bool IsLoad { get; set; }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..f8d477b0e53d
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..cf3437687c26
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..95c6a7795388
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public bool IsLoad { get; set; }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml
new file mode 100644
index 000000000000..f8d477b0e53d
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Add_Remove/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..cf3437687c26
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..95c6a7795388
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public bool IsLoad { get; set; }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..f8d477b0e53d
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/Scenario.json
new file mode 100644
index 000000000000..0082bb971c68
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Remove/Scenario.json
@@ -0,0 +1,26 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "IsCrashingRoslyn": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "IsCrashingRoslyn": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..cf3437687c26
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/0/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..95c6a7795388
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/0/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public bool IsLoad { get; set; }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..f9431b00eee0
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/1/p1/MainPage.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..dd00b78c5983
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/1/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public bool IsLoad2 { get; set; }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_DataTemplate_xLoad_xBind_Update/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xBind_Function_Property_Add/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xBind_Function_Property_Add/Scenario.json
index 4cf322b56ccb..b5b0bc0ca853 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xBind_Function_Property_Add/Scenario.json
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xBind_Function_Property_Add/Scenario.json
@@ -15,11 +15,8 @@
"IsMono": true,
"PassResults": [
{
- "MetadataUpdates": 0,
- "Diagnostics": [
- { "Id": "ENC0100" },
- { "Id": "ENC0100" }
- ]
+ "MetadataUpdates": 1,
+ "Diagnostics": []
}
]
},
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xBind_Simple_Property/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xBind_Simple_Property/Scenario.json
index 5fadff3f63f6..902d6383b5fd 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xBind_Simple_Property/Scenario.json
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xBind_Simple_Property/Scenario.json
@@ -15,11 +15,8 @@
"IsMono": true,
"PassResults": [
{
- "MetadataUpdates": 0,
- "Diagnostics": [
- { "Id": "ENC0100" },
- { "Id": "ENC0100" }
- ]
+ "MetadataUpdates": 1,
+ "Diagnostics": []
}
]
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_ElementName_Add/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_ElementName_Add/Scenario.json
index 9ad219e48030..902d6383b5fd 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_ElementName_Add/Scenario.json
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_ElementName_Add/Scenario.json
@@ -15,12 +15,8 @@
"IsMono": true,
"PassResults": [
{
- "MetadataUpdates": 0,
- "Diagnostics": [
- // error ENC0100: Adding field requires restarting the application.
- { "Id": "ENC0100" },
- { "Id": "ENC0100" }
- ]
+ "MetadataUpdates": 1,
+ "Diagnostics": []
}
]
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_ResourceDictionary_Change_One/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_ResourceDictionary_Change_One/Scenario.json
index 86551eda6a53..de8d12250139 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_ResourceDictionary_Change_One/Scenario.json
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_ResourceDictionary_Change_One/Scenario.json
@@ -16,11 +16,8 @@
"IsMono": true,
"PassResults": [
{
- "MetadataUpdates": 0,
- "Diagnostics": [
- { "Id": "ENC0100" },
- { "Id": "ENC0100" }
- ]
+ "MetadataUpdates": 1,
+ "Diagnostics": []
}
]
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add/Scenario.json
index fd80816c40ad..902d6383b5fd 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add/Scenario.json
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add/Scenario.json
@@ -15,10 +15,8 @@
"IsMono": true,
"PassResults": [
{
- "MetadataUpdates": 0,
- "Diagnostics": [
- { "Id": "ENC0100" }
- ]
+ "MetadataUpdates": 1,
+ "Diagnostics": []
}
]
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/0/p1/MainPage.xaml
similarity index 93%
rename from src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/0/p1/MainPage.xaml
rename to src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/0/p1/MainPage.xaml
index 379c0c54d525..b6ed5c8d0912 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/0/p1/MainPage.xaml
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/0/p1/MainPage.xaml
@@ -7,7 +7,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
-
+
-
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..90d05e86776a
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..58831c5ef849
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+
+ test.Tag = "42";
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/2/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/2/p1/MainPage.xaml
new file mode 100644
index 000000000000..b6ed5c8d0912
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/2/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/2/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/2/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/2/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Remove/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Twice/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Twice/Scenario.json
index 79bdfccfc0c5..c874338e4299 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Twice/Scenario.json
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Add_Twice/Scenario.json
@@ -13,46 +13,43 @@
"Diagnostics": []
}
]
- },
+ }
+ ,
{
"IsDebug": true,
"IsMono": true,
"PassResults": [
{
- "MetadataUpdates": 0,
- "Diagnostics": [
- // error ENC0100: Adding field requires restarting the application.
- { "Id": "ENC0100" }
- ]
+ "MetadataUpdates": 1,
+ "Diagnostics": []
},
{
- "MetadataUpdates": 0,
- "Diagnostics": [
- // MainPage_c2bc688a73eab5431d787dcd21fe32b9.cs(102,59): error ENC0100: Adding field requires restarting the application.
- { "Id": "ENC0100" },
- { "Id": "ENC0100" }
- ]
+ "MetadataUpdates": 1,
+ "Diagnostics": []
}
]
- },
+ },
{
"IsDebug": false,
"IsMono": false,
"PassResults": [
{
- "MetadataUpdates": 1,
- "Diagnostics": []
+ "MetadataUpdates": 0,
+ "Diagnostics": [
+ // MainPage_e249a1283df7035b4d61c8549853c03e.cs(75,138): error ENC0053: Changing the parameters of lambda requires restarting the application.
+ { "Id": "ENC0053" },
+ { "Id": "ENC0053" },
+ { "Id": "ENC0053" }
+ ]
},
{
"MetadataUpdates": 0,
"Diagnostics": [
- // MainPage_c2bc688a73eab5431d787dcd21fe32b9.cs(68,83): error ENC0049: Ceasing to capture variable '__that' requires restarting the application.
- { "Id": "ENC0049" },
- { "Id": "ENC0049" },
-
- // error ENC0009: Updating the type of method requires restarting the application.
- { "Id": "ENC0009" },
- { "Id": "ENC0009" }
+ // MainPage_e249a1283df7035b4d61c8549853c03e.cs(75,138): error ENC0053: Changing the parameters of lambda requires restarting the application.
+ { "Id": "ENC0053" },
+ { "Id": "ENC0053" },
+ { "Id": "ENC0053" },
+ { "Id": "ENC0053" }
]
}
]
@@ -64,20 +61,20 @@
{
"MetadataUpdates": 0,
"Diagnostics": [
- // error ENC0100: Adding field requires restarting the application.
- { "Id": "ENC0100" }
+ // MainPage_e249a1283df7035b4d61c8549853c03e.cs(75,138): error ENC0053: Changing the parameters of lambda requires restarting the application.
+ { "Id": "ENC0053" },
+ { "Id": "ENC0053" },
+ { "Id": "ENC0053" }
]
},
{
"MetadataUpdates": 0,
"Diagnostics": [
- // MainPage_c2bc688a73eab5431d787dcd21fe32b9.cs(68,83): error ENC0049: Ceasing to capture variable '__that' requires restarting the application.
- { "Id": "ENC0049" },
- { "Id": "ENC0049" },
-
- // error ENC0009: Updating the type of method requires restarting the application.
- { "Id": "ENC0009" },
- { "Id": "ENC0009" }
+ // MainPage_e249a1283df7035b4d61c8549853c03e.cs(75,138): error ENC0053: Changing the parameters of lambda requires restarting the application.
+ { "Id": "ENC0053" },
+ { "Id": "ENC0053" },
+ { "Id": "ENC0053" },
+ { "Id": "ENC0053" }
]
}
]
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Change/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Change/Scenario.json
index ad26e810ea37..902d6383b5fd 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Change/Scenario.json
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Change/Scenario.json
@@ -5,11 +5,8 @@
"IsMono": false,
"PassResults": [
{
- "MetadataUpdates": 0,
- "Diagnostics": [
- // error ENC0009: Updating the type of method requires restarting the application.
- { "Id": "ENC0009" }
- ]
+ "MetadataUpdates": 1,
+ "Diagnostics": []
}
]
},
@@ -18,11 +15,8 @@
"IsMono": true,
"PassResults": [
{
- "MetadataUpdates": 0,
- "Diagnostics": [
- // error ENC0009: Updating the type of method requires restarting the application.
- { "Id": "ENC0009" }
- ]
+ "MetadataUpdates": 1,
+ "Diagnostics": []
}
]
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..90d05e86776a
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/0/p1/MainPage.xaml.cs
similarity index 100%
rename from src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/1/p1/MainPage.xaml.cs
rename to src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/0/p1/MainPage.xaml.cs
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..b6ed5c8d0912
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Single_xName_Remove/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add/Scenario.json
index 4e475a075a5d..902d6383b5fd 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add/Scenario.json
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add/Scenario.json
@@ -15,13 +15,8 @@
"IsMono": true,
"PassResults": [
{
- "MetadataUpdates": 0,
- "Diagnostics": [
- // MainPage_c2bc688a73eab5431d787dcd21fe32b9.cs(132,3): error ENC0100: Adding auto-property requires restarting the application.
- { "Id": "ENC0100" },
- { "Id": "ENC0100" },
- { "Id": "ENC0100" }
- ]
+ "MetadataUpdates": 1,
+ "Diagnostics": []
}
]
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..af7af9e658da
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..e61cc70fec65
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..53901f90f5a2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public void OnClick()
+ {
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/2/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/2/p1/MainPage.xaml
new file mode 100644
index 000000000000..af7af9e658da
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/2/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/2/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/2/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/2/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Add_Remove/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..e61cc70fec65
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..53901f90f5a2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public void OnClick()
+ {
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..af7af9e658da
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Event_Remove/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..f056c2f191e5
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..18224cca29af
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public string MyProperty => "42";
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..850defda0a4c
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..cd81deb593e2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public string MyProperty => "42";
+
+ public string TestFunction(string param) => param;
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/2/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/2/p1/MainPage.xaml
new file mode 100644
index 000000000000..f056c2f191e5
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/2/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/2/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/2/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..18224cca29af
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/2/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public string MyProperty => "42";
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/Scenario.json
new file mode 100644
index 000000000000..b5b0bc0ca853
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Add_Remove/Scenario.json
@@ -0,0 +1,46 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "UseXamlReaderReload": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "UseXamlReaderReload": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..850defda0a4c
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..cd81deb593e2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public string MyProperty => "42";
+
+ public string TestFunction(string param) => param;
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..f056c2f191e5
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..18224cca29af
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public string MyProperty => "42";
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/Scenario.json
new file mode 100644
index 000000000000..b5b0bc0ca853
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xBind_Function_Property_Remove/Scenario.json
@@ -0,0 +1,46 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "UseXamlReaderReload": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "UseXamlReaderReload": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..629ef5d86c51
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/0/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/0/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/1/p1/MainPage.xaml
similarity index 100%
rename from src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_Add_xLoad/1/p1/MainPage.xaml
rename to src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/1/p1/MainPage.xaml
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..9e0991449748
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/1/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+
+ test.Text = "42";
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..629ef5d86c51
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..be676b60c41c
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..9e0991449748
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+
+ test.Text = "42";
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/2/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/2/p1/MainPage.xaml
new file mode 100644
index 000000000000..629ef5d86c51
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/2/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/2/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/2/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/2/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Add_Remove/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..be676b60c41c
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..629ef5d86c51
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..9e0991449748
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+
+ test.Text = "42";
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Remove/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..fef9fa9a21c1
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/0/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/0/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..be676b60c41c
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/1/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..9e0991449748
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/1/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+
+ test.Text = "42";
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_Update/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..629ef5d86c51
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/0/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/0/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..f0e98602e8d2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/1/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..78f1ab0c2b58
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/1/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+
+ test.Text = "42";
+ }
+
+ public bool IsLoad { get; set; }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..629ef5d86c51
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..f0e98602e8d2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..78f1ab0c2b58
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+
+ test.Text = "42";
+ }
+
+ public bool IsLoad { get; set; }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml
new file mode 100644
index 000000000000..629ef5d86c51
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/2/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Add_Remove/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..f0e98602e8d2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/0/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..78f1ab0c2b58
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/0/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+
+ test.Text = "42";
+ }
+
+ public bool IsLoad { get; set; }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..2fc2646914b0
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/1/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..46867f561656
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/1/p1/MainPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/Scenario.json
new file mode 100644
index 000000000000..0082bb971c68
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Remove/Scenario.json
@@ -0,0 +1,26 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "IsCrashingRoslyn": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "IsCrashingRoslyn": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/0/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/0/p1/MainPage.xaml
new file mode 100644
index 000000000000..f0e98602e8d2
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/0/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/0/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/0/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..78f1ab0c2b58
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/0/p1/MainPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+
+ test.Text = "42";
+ }
+
+ public bool IsLoad { get; set; }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/1/p1/MainPage.xaml b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/1/p1/MainPage.xaml
new file mode 100644
index 000000000000..c5684bc56081
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/1/p1/MainPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/1/p1/MainPage.xaml.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/1/p1/MainPage.xaml.cs
new file mode 100644
index 000000000000..dd00b78c5983
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/1/p1/MainPage.xaml.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+namespace Test01;
+
+public sealed partial class MainPage : Page
+{
+ public MainPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public bool IsLoad2 { get; set; }
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/Scenario.json b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/Scenario.json
new file mode 100644
index 000000000000..902d6383b5fd
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/When_Simple_Xaml_xLoad_xBind_Update/Scenario.json
@@ -0,0 +1,24 @@
+{
+ "Scenarios": [
+ {
+ "IsDebug": true,
+ "IsMono": false,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ },
+ {
+ "IsDebug": true,
+ "IsMono": true,
+ "PassResults": [
+ {
+ "MetadataUpdates": 1,
+ "Diagnostics": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdates/HotReloadWorkspaceProvider.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdates/HotReloadWorkspaceProvider.cs
index b4a5f9bedbc9..714162009c16 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdates/HotReloadWorkspaceProvider.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdates/HotReloadWorkspaceProvider.cs
@@ -21,8 +21,20 @@ internal class HotReloadWorkspace
{
public record UpdateResult(ImmutableArray Diagnostics, ImmutableArray MetadataUpdates);
+#if NET7_0
const string NetCoreCapsRaw = "Baseline AddMethodToExistingType AddStaticFieldToExistingType AddInstanceFieldToExistingType NewTypeDefinition ChangeCustomAttributes UpdateParameters";
const string MonoCapsRaw = "Baseline AddMethodToExistingType AddStaticFieldToExistingType NewTypeDefinition ChangeCustomAttributes";
+#elif NET8_0
+ const string NetCoreCapsRaw = "Baseline AddMethodToExistingType AddStaticFieldToExistingType AddInstanceFieldToExistingType NewTypeDefinition ChangeCustomAttributes UpdateParameters GenericUpdateMethod GenericAddMethodToExistingType GenericAddFieldToExistingType";
+ const string MonoCapsRaw = "Baseline AddMethodToExistingType AddStaticFieldToExistingType AddInstanceFieldToExistingType NewTypeDefinition ChangeCustomAttributes UpdateParameters GenericUpdateMethod GenericAddMethodToExistingType GenericAddFieldToExistingType";
+#elif NET9_0
+ // https://github.com/dotnet/runtime/blob/e99557baffbe864d624cc1c95c9cbf2eefae684f/src/coreclr/System.Private.CoreLib/src/System/Reflection/Metadata/MetadataUpdater.cs#L58
+ const string NetCoreCapsRaw = "Baseline AddMethodToExistingType AddStaticFieldToExistingType AddInstanceFieldToExistingType NewTypeDefinition ChangeCustomAttributes UpdateParameters GenericUpdateMethod GenericAddMethodToExistingType GenericAddFieldToExistingType";
+ // https://github.com/dotnet/runtime/blob/e99557baffbe864d624cc1c95c9cbf2eefae684f/src/mono/mono/component/hot_reload.c#L3330
+ const string MonoCapsRaw = "Baseline AddMethodToExistingType AddStaticFieldToExistingType NewTypeDefinition ChangeCustomAttributes AddInstanceFieldToExistingType GenericAddMethodToExistingType GenericUpdateMethod UpdateParameters GenericAddFieldToExistingType";
+#else
+#error This runtime is not supported yet, find the caps in the .NET runtime's sources
+#endif
private readonly string _baseWorkFolder;
private readonly bool _isDebugCompilation;
@@ -79,7 +91,18 @@ public void SetSourceFile(string project, string fileName, string content)
var basePath = Path.Combine(_baseWorkFolder, project);
var filePath = Path.Combine(basePath, fileName);
Directory.CreateDirectory(basePath);
- File.WriteAllText(filePath, content, Encoding.UTF8);
+ for (var i = 2; i >= 0; i--)
+ {
+ try
+ {
+ File.WriteAllText(filePath, content, Encoding.UTF8);
+ break;
+ }
+ catch (IOException) when (i is not 0)
+ {
+ Task.Delay(100).Wait();
+ }
+ }
if (_currentSolution is not null)
{
@@ -190,6 +213,18 @@ public async Task Initialize(CancellationToken ct)
currentSolution = project.Solution;
+ // Build the analyzer document additional data information
+ var analyzerDocumentId = DocumentId.CreateNewId(project.Id);
+
+ // For now, there is no need to customize these for each test.
+ var globalConfigBuilder = new StringBuilder($"""
+ is_global = true
+ build_property.MSBuildProjectFullPath = C:\Project\{project.Name}.csproj
+ build_property.RootNamespace = {project.Name}
+ build_property.XamlSourceGeneratorTracingFolder = {_baseWorkFolder}
+ build_property.Configuration = {(_isDebugCompilation ? "Debug" : "Release")}
+
+ """);
if (_sourceFiles.TryGetValue(projectName, out var sourceFiles))
{
foreach (var (fileName, content) in sourceFiles)
@@ -217,38 +252,22 @@ public async Task Initialize(CancellationToken ct)
filePath: Path.Combine(_baseWorkFolder, project.Name, fileName));
}
- if (additionalFiles.Any())
+ foreach (var (fileName, content) in additionalFiles.Where(k => k.Key.EndsWith(".xaml")))
{
- // Build the analyzer document additional data information
- var analyzerDocumentId = DocumentId.CreateNewId(project.Id);
-
- // For now, there is no need to customize these for each test.
- var globalConfigBuilder = new StringBuilder($"""
- is_global = true
- build_property.MSBuildProjectFullPath = C:\Project\{project.Name}.csproj
- build_property.RootNamespace = {project.Name}
- build_property.XamlSourceGeneratorTracingFolder = {_baseWorkFolder}
- build_property.Configuration = {(_isDebugCompilation ? "Debug" : "Release")}
-
- """); ;
-
- foreach (var (fileName, content) in additionalFiles.Where(k => k.Key.EndsWith(".xaml")))
- {
- globalConfigBuilder.Append($"""
- [{Path.Combine(_baseWorkFolder, project.Name, fileName).Replace("\\", "/")}]
- build_metadata.AdditionalFiles.SourceItemGroup = Page
- """);
- }
-
- currentSolution = currentSolution.AddAnalyzerConfigDocument(
- analyzerDocumentId,
- name: ".globalconfig",
- filePath: "/.globalconfig",
- text: SourceText.From(globalConfigBuilder.ToString())
- ); ;
+ globalConfigBuilder.Append($"""
+ [{Path.Combine(_baseWorkFolder, project.Name, fileName).Replace("\\", "/")}]
+ build_metadata.AdditionalFiles.SourceItemGroup = Page
+ """);
}
}
+ currentSolution = currentSolution.AddAnalyzerConfigDocument(
+ analyzerDocumentId,
+ name: ".globalconfig",
+ filePath: "/.globalconfig",
+ text: SourceText.From(globalConfigBuilder.ToString())
+ );
+
workspace.TryApplyChanges(currentSolution);
}
@@ -371,9 +390,14 @@ private static PortableExecutableReference[] BuildUnoReferences()
#endif
var availableTargets = new[] {
+ // On CI the test assemblies set must be first, as it contains all
+ // dependent assemblies, which the other platforms don't (see DisablePrivateProjectReference).
+ Path.Combine("Uno.UI.Tests", configuration, "net8.0"),
Path.Combine("Uno.UI.Skia", configuration, "net8.0"),
Path.Combine("Uno.UI.Reference", configuration, "net8.0"),
- Path.Combine("Uno.UI.Tests", configuration, "net8.0"),
+ Path.Combine("Uno.UI.Tests", configuration, "net9.0"),
+ Path.Combine("Uno.UI.Skia", configuration, "net9.0"),
+ Path.Combine("Uno.UI.Reference", configuration, "net9.0"),
};
var unoUIBase = Path.Combine(
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/Uno.UI.SourceGenerators.Tests.csproj b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/Uno.UI.SourceGenerators.Tests.csproj
index d15532a30aa0..fad382f237a4 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/Uno.UI.SourceGenerators.Tests.csproj
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/Uno.UI.SourceGenerators.Tests.csproj
@@ -1,11 +1,11 @@
-
+
- $(NetPrevious)
+ $(NetCurrent)
false
enable
enable
@@ -41,10 +41,10 @@
-
-
-
-
+
+
+
+
@@ -286,6 +286,7 @@
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/Verifiers/CSGenerator.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/Verifiers/CSGenerator.cs
index 85a8073a1f1d..ac290995273f 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/Verifiers/CSGenerator.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/Verifiers/CSGenerator.cs
@@ -13,7 +13,9 @@ namespace Uno.UI.SourceGenerators.Tests.Verifiers
public static partial class CSharpSourceGeneratorVerifier
where TSourceGenerator : ISourceGenerator, new()
{
+#pragma warning disable CS0618 // Type or member is obsolete
public class Test : CSharpSourceGeneratorTest
+#pragma warning restore CS0618 // Type or member is obsolete
{
public LanguageVersion LanguageVersion { get; set; } = LanguageVersion.Default;
public bool IgnoreAccessibility { get; set; }
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_HotReloadEnabledInBuild.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_HotReloadEnabledInBuild.cs
index f50760033679..8694075a0a51 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_HotReloadEnabledInBuild.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_HotReloadEnabledInBuild.cs
@@ -9,9 +9,6 @@ namespace Uno.UI.SourceGenerators.Tests.XamlCodeGeneratorTests;
[TestClass]
public class Given_HotReloadEnabledInBuild
{
- // Specify this centrally for all tests that rely on Uno5 or above
- private static readonly ReferenceAssemblies _net8Uno5Refs = ReferenceAssemblies.Net.Net80.AddPackages([new PackageIdentity("Uno.WinUI", "5.0.118")]);
-
[TestMethod]
public async Task SetBaseUriIncludedInOutputForFrameworkElements()
{
@@ -57,7 +54,7 @@ public MainPage()
"""
}
},
- ReferenceAssemblies = _net8Uno5Refs,
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
DisableBuildReferences = true,
GlobalConfigOverride = configOverride,
}.AddGeneratedSources();
@@ -111,7 +108,7 @@ public MainPage()
"""
}
},
- ReferenceAssemblies = _net8Uno5Refs,
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
GlobalConfigOverride = configOverride,
}.AddGeneratedSources();
@@ -161,7 +158,7 @@ public MainPage()
"""
}
},
- ReferenceAssemblies = _net8Uno5Refs,
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
GlobalConfigOverride = configOverride,
}.AddGeneratedSources();
@@ -220,7 +217,7 @@ public MainPage()
"""
}
},
- ReferenceAssemblies = _net8Uno5Refs,
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
GlobalConfigOverride = configOverride,
}.AddGeneratedSources();
@@ -243,7 +240,7 @@ public async Task SetOriginalSourceLocationInOutputForTopLevelResourceDictionari
var test = new Verify.Test(xamlFile)
{
- ReferenceAssemblies = _net8Uno5Refs,
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
DisableBuildReferences = true,
GlobalConfigOverride = configOverride,
}.AddGeneratedSources();
@@ -329,7 +326,7 @@ public MainPage()
"""
}
},
- ReferenceAssemblies = _net8Uno5Refs,
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
GlobalConfigOverride = configOverride,
}.AddGeneratedSources();
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_LazyLoading.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_LazyLoading.cs
index 2d8e360ad10c..c0fc65dcc9f5 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_LazyLoading.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_LazyLoading.cs
@@ -55,7 +55,7 @@ public MainPage()
"""
}
},
- ReferenceAssemblies = ReferenceAssemblies.Net.Net70.AddPackages(ImmutableArray.Create(new PackageIdentity("Uno.WinUI", "5.0.118"))),
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
DisableBuildReferences = true,
}.AddGeneratedSources();
@@ -114,7 +114,7 @@ public string InnerText
"""
}
},
- ReferenceAssemblies = ReferenceAssemblies.Net.Net70.AddPackages(ImmutableArray.Create(new PackageIdentity("Uno.WinUI", "5.0.118"))),
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
DisableBuildReferences = true,
}.AddGeneratedSources();
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_MvvmGeneratedMembers.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_MvvmGeneratedMembers.cs
index 2749d697dc55..9a7c1af3e9ef 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_MvvmGeneratedMembers.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_MvvmGeneratedMembers.cs
@@ -267,11 +267,11 @@ public void MyBindBack(string s) { }
test.ExpectedDiagnostics.AddRange(new[]
{
// Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\MainPage_d6cd66944958ced0c513e0a04797b51d.cs(75,239): error CS1061: 'MyViewModel' does not contain a definition for 'Name' and no accessible extension method 'Name' accepting a first argument of type 'MyViewModel' could be found (are you missing a using directive or an assembly reference?)
- DiagnosticResult.CompilerError("CS1061").WithSpan(@"Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\MainPage_d6cd66944958ced0c513e0a04797b51d.cs", 72, 239, 72, 243).WithArguments("TestRepro.MyViewModel", "Name"),
+ DiagnosticResult.CompilerError("CS1061").WithSpan(@"Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\MainPage_d6cd66944958ced0c513e0a04797b51d.cs", 72, 238, 72, 242).WithArguments("TestRepro.MyViewModel", "Name"),
// Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\MainPage_d6cd66944958ced0c513e0a04797b51d.cs(97,239): error CS1061: 'MyViewModel' does not contain a definition for 'Name' and no accessible extension method 'Name' accepting a first argument of type 'MyViewModel' could be found (are you missing a using directive or an assembly reference?)
- DiagnosticResult.CompilerError("CS1061").WithSpan(@"Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\MainPage_d6cd66944958ced0c513e0a04797b51d.cs", 94, 239, 94, 243).WithArguments("TestRepro.MyViewModel", "Name"),
+ DiagnosticResult.CompilerError("CS1061").WithSpan(@"Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\MainPage_d6cd66944958ced0c513e0a04797b51d.cs", 94, 238, 94, 242).WithArguments("TestRepro.MyViewModel", "Name"),
// Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\MainPage_d6cd66944958ced0c513e0a04797b51d.cs(119,239): error CS1061: 'MyViewModel' does not contain a definition for 'Name' and no accessible extension method 'Name' accepting a first argument of type 'MyViewModel' could be found (are you missing a using directive or an assembly reference?)
- DiagnosticResult.CompilerError("CS1061").WithSpan(@"Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\MainPage_d6cd66944958ced0c513e0a04797b51d.cs", 116, 239, 116, 243).WithArguments("TestRepro.MyViewModel", "Name"),
+ DiagnosticResult.CompilerError("CS1061").WithSpan(@"Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\MainPage_d6cd66944958ced0c513e0a04797b51d.cs", 116, 238, 116, 242).WithArguments("TestRepro.MyViewModel", "Name"),
});
await test.RunAsync();
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_NoFuzzyMatching.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_NoFuzzyMatching.cs
index e888a87b7b7d..60a16262df0d 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_NoFuzzyMatching.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_NoFuzzyMatching.cs
@@ -52,7 +52,7 @@ public MainPage()
"""
}
},
- ReferenceAssemblies = ReferenceAssemblies.Net.Net80Android.AddPackages(ImmutableArray.Create(new PackageIdentity("Uno.WinUI", "5.0.118"))),
+ ReferenceAssemblies = _Dotnet.CurrentAndroid.WithUnoPackage(),
DisableBuildReferences = true,
}.AddGeneratedSources();
@@ -105,7 +105,7 @@ public MainPage()
"""
}
},
- ReferenceAssemblies = ReferenceAssemblies.Net.Net80.AddPackages(ImmutableArray.Create(new PackageIdentity("Uno.WinUI", "5.0.118"))),
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage(),
DisableBuildReferences = true,
}.AddGeneratedSources();
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_Parser.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_Parser.cs
index 564de8ae600e..a56e68a54d9b 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_Parser.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_Parser.cs
@@ -363,7 +363,7 @@ public MainPage()
}
},
DisableBuildReferences = true,
- ReferenceAssemblies = ReferenceAssemblies.Net.Net80Android.AddPackages([new PackageIdentity("SkiaSharp.Views.Uno.WinUI", "3.0.0-preview.3.1")]),
+ ReferenceAssemblies = _Dotnet.CurrentAndroid.ReferenceAssemblies.AddPackages([new PackageIdentity("SkiaSharp.Views.Uno.WinUI", "3.0.0-preview.3.1")]),
}.AddGeneratedSources();
await test.RunAsync();
@@ -411,7 +411,7 @@ private void Window_Closed(object sender, WindowEventArgs args) { }
}
},
DisableBuildReferences = true,
- ReferenceAssemblies = ReferenceAssemblies.Net.Net80.AddPackages([new PackageIdentity("Uno.WinUI", "5.3.114")]),
+ ReferenceAssemblies = _Dotnet.Current.WithUnoPackage("5.3.114"),
}.AddGeneratedSources();
await test.RunAsync();
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_Xuid.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_Xuid.cs
index c29e7cb11926..c3969001f422 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_Xuid.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_Xuid.cs
@@ -51,7 +51,7 @@ public XuidGeneratorError()
"""
}
},
- ReferenceAssemblies = ReferenceAssemblies.Net.Net80Android.AddPackages(ImmutableArray.Create(new PackageIdentity("Uno.WinUI", "5.0.118"))),
+ ReferenceAssemblies = _Dotnet.CurrentAndroid.WithUnoPackage(),
DisableBuildReferences = true,
}.AddGeneratedSources();
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SBUIIOFFE/XamlCodeGenerator_GlobalStaticResources.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SBUIIOFFE/XamlCodeGenerator_GlobalStaticResources.cs
index 0dc326678c53..b22252d3f926 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SBUIIOFFE/XamlCodeGenerator_GlobalStaticResources.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SBUIIOFFE/XamlCodeGenerator_GlobalStaticResources.cs
@@ -4,6 +4,7 @@ namespace MyProject
///
/// Contains all the static resources defined for the application
///
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
public sealed partial class GlobalStaticResources
{
static bool _initialized;
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SBUIIOFFE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SBUIIOFFE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index bfc9addda4b5..aea9e14cc033 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SBUIIOFFE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SBUIIOFFE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -34,11 +34,8 @@
namespace TestRepro
{
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- internal string __checksum() => "b9972598331e683fbb77aea763a897b0b45bc3d6";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
@@ -46,12 +43,6 @@ partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page
private global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
private void InitializeComponent()
{
- var __resourceLocator = new global::System.Uri("file:///C:/Project/0/MainPage.xaml");
- if(global::Uno.UI.ApplicationHelper.IsLoadableComponent(__resourceLocator))
- {
- global::Microsoft.UI.Xaml.Application.LoadComponent(this, __resourceLocator);
- return;
- }
NameScope.SetNameScope(this, __nameScope);
var __that = this;
base.IsParsing = true;
@@ -71,43 +62,89 @@ private void InitializeComponent()
FontSize = 30d,
// Source 0\MainPage.xaml (Line 9:4)
}
- .GenericApply(__that, __nameScope, ((c0, __that, __nameScope) =>
- {
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 9, 4);
- c0.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_0 ))
,
}
}
- .GenericApply(__that, __nameScope, ((c1, __that, __nameScope) =>
- {
- global::Uno.UI.Toolkit.VisibleBoundsPadding.SetPaddingMask(c1, global::Uno.UI.Toolkit.VisibleBoundsPadding.PaddingMask.Top);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 8, 3);
- c1.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_1 ))
;
this
- .GenericApply(__that, __nameScope, ((c2, __that, __nameScope) =>
+ .GenericApply(__that, __nameScope, (ApplyMethod_2 ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_3 ))
+ ;
+ OnInitializeCompleted();
+
+ }
+ partial void OnInitializeCompleted();
+ private void ApplyMethod_0(global::Microsoft.UI.Xaml.Controls.TextBlock __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 9, 4);
+ __p1.CreationComplete();
+ }
+
+ private void ApplyMethod_1(global::Microsoft.UI.Xaml.Controls.Grid __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Toolkit.VisibleBoundsPadding.SetPaddingMask(__p1, global::Uno.UI.Toolkit.VisibleBoundsPadding.PaddingMask.Top);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 8, 3);
+ __p1.CreationComplete();
+ }
+
+ private void ApplyMethod_2(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
// Source 0\MainPage.xaml (Line 1:2)
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
- ))
- .GenericApply(__that, __nameScope, ((c3, __that, __nameScope) =>
+
+ private void ApplyMethod_3(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
// Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 1, 2);
- c3.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 1, 2);
+ __p1.CreationComplete();
}
- ))
- ;
- OnInitializeCompleted();
+ private interface IMainPage_Bindings
+ {
+ void Initialize();
+ void Update();
+ void UpdateResources();
+ void StopTracking();
+ void NotifyXLoad(string name);
+ }
+ #pragma warning disable 0169 // Suppress unused field warning in case Bindings is not used.
+ private IMainPage_Bindings Bindings;
+ #pragma warning restore 0169
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ private class MainPage_Bindings : IMainPage_Bindings
+ {
+ #if UNO_HAS_UIELEMENT_IMPLICIT_PINNING
+ private global::System.WeakReference _ownerReference;
+ private global::TestRepro.MainPage Owner { get => (global::TestRepro.MainPage)_ownerReference?.Target; set => _ownerReference = new global::System.WeakReference(value); }
+ #else
+ private global::TestRepro.MainPage Owner { get; set; }
+ #endif
+ public MainPage_Bindings(global::TestRepro.MainPage owner)
+ {
+ Owner = owner;
+ }
+ void IMainPage_Bindings.NotifyXLoad(string name)
+ {
+ }
+ void IMainPage_Bindings.Initialize()
+ {
+ }
+ void IMainPage_Bindings.Update()
+ {
+ var owner = Owner;
+ }
+ void IMainPage_Bindings.UpdateResources()
+ {
+ var owner = Owner;
+ }
+ void IMainPage_Bindings.StopTracking()
+ {
+ }
}
- partial void OnInitializeCompleted();
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIIOFDOTAFE/XamlCodeGenerator_GlobalStaticResources.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIIOFDOTAFE/XamlCodeGenerator_GlobalStaticResources.cs
index 1efc369d512c..c3128646b018 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIIOFDOTAFE/XamlCodeGenerator_GlobalStaticResources.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIIOFDOTAFE/XamlCodeGenerator_GlobalStaticResources.cs
@@ -4,6 +4,7 @@ namespace MyProject
///
/// Contains all the static resources defined for the application
///
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
public sealed partial class GlobalStaticResources
{
static bool _initialized;
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIIOFDOTAFE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIIOFDOTAFE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 65f295fa7b90..3927204b0ead 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIIOFDOTAFE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIIOFDOTAFE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -34,11 +34,8 @@
namespace TestRepro
{
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- internal string __checksum() => "346ee2c4a3294fdba50b4b5daaa042583c405e7a";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
@@ -46,12 +43,6 @@ partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page
private global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
private void InitializeComponent()
{
- var __resourceLocator = new global::System.Uri("file:///C:/Project/0/MainPage.xaml");
- if(global::Uno.UI.ApplicationHelper.IsLoadableComponent(__resourceLocator))
- {
- global::Microsoft.UI.Xaml.Application.LoadComponent(this, __resourceLocator);
- return;
- }
NameScope.SetNameScope(this, __nameScope);
var __that = this;
base.IsParsing = true;
@@ -59,64 +50,64 @@ private void InitializeComponent()
typeof(global::Microsoft.UI.Xaml.Controls.TextBlock)
] =
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
- new global::Microsoft.UI.Xaml.Style
- {
- TargetType = typeof(global::Microsoft.UI.Xaml.Controls.TextBlock),
- // Source 0\MainPage.xaml (Line 7:6)
- Setters =
+ {
+ return
+ new global::Microsoft.UI.Xaml.Style
{
- new global::Microsoft.UI.Xaml.Setter
+ TargetType = typeof(global::Microsoft.UI.Xaml.Controls.TextBlock),
+ // Source 0\MainPage.xaml (Line 7:6)
+ Setters =
{
- Property = global::Microsoft.UI.Xaml.Controls.TextBlock.ForegroundProperty,
- Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Red),
- // Source 0\MainPage.xaml (Line 8:8)
+ new global::Microsoft.UI.Xaml.Setter
+ {
+ Property = global::Microsoft.UI.Xaml.Controls.TextBlock.ForegroundProperty,
+ Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Red),
+ // Source 0\MainPage.xaml (Line 8:8)
+ }
+ ,
}
- ,
}
- }
- .GenericApply(__that, __nameScope, ((c1, __that, __nameScope) =>
- {
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L7:6");
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_1 ))
+ ;
+ }
)
;
Resources[
"MyCustomButtonStyle"
] =
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
- new global::Microsoft.UI.Xaml.Style
- {
- TargetType = typeof(global::Microsoft.UI.Xaml.Controls.Button),
- // Source 0\MainPage.xaml (Line 10:6)
- Setters =
+ {
+ return
+ new global::Microsoft.UI.Xaml.Style
{
- new global::Microsoft.UI.Xaml.Setter
+ TargetType = typeof(global::Microsoft.UI.Xaml.Controls.Button),
+ // Source 0\MainPage.xaml (Line 10:6)
+ Setters =
{
- Property = global::Microsoft.UI.Xaml.Controls.Button.BackgroundProperty,
- Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Azure),
- // Source 0\MainPage.xaml (Line 11:8)
+ new global::Microsoft.UI.Xaml.Setter
+ {
+ Property = global::Microsoft.UI.Xaml.Controls.Button.BackgroundProperty,
+ Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Azure),
+ // Source 0\MainPage.xaml (Line 11:8)
+ }
+ ,
}
- ,
}
- }
- .GenericApply(__that, __nameScope, ((c4, __that, __nameScope) =>
- {
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c4, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L10:6");
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_4 ))
+ ;
+ }
)
;
Resources[
"MyItemTemplate"
] =
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
- new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => ((I_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0)global::Uno.UI.Helpers.TypeMappings.CreateInstance<_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0>()).Build(__owner)
- ) .GenericApply(__that, __nameScope, ((c6, __that, __nameScope) =>
- {
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c6, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L13:6");
- }
- ))
+ {
+ return
+ new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0().Build(__owner)
+ ) .GenericApply(__that, __nameScope, (ApplyMethod_6 ))
+ ;
+ }
)
;
// Source 0\MainPage.xaml (Line 1:2)
@@ -125,43 +116,125 @@ private void InitializeComponent()
{
IsParsing = true,
Name = "TheListView",
- HeaderTemplate = new global::Microsoft.UI.Xaml.DataTemplate(this, (__owner) => ((I_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC1)global::Uno.UI.Helpers.TypeMappings.CreateInstance<_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC1>()).Build(__owner)
- ) .GenericApply(__that, __nameScope, ((c7, __that, __nameScope) =>
- {
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c7, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L42:8");
- }
- ))
+ HeaderTemplate = new global::Microsoft.UI.Xaml.DataTemplate(this, (__owner) => new _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC1().Build(__owner)
+ ) .GenericApply(__that, __nameScope, (ApplyMethod_7 ))
,
// Source 0\MainPage.xaml (Line 40:4)
}
- .GenericApply(__that, __nameScope, ((c8, __that, __nameScope) =>
- {
- /* _isTopLevelDictionary:False */
- __that._component_0 = c8;
- __nameScope.RegisterName("TheListView", c8);
- __that.TheListView = c8;
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c8, global::Microsoft.UI.Xaml.Controls.ListView.ItemTemplateProperty, "MyItemTemplate", isThemeResourceExtension: false, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c8, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 40, 4);
- c8.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_8 ))
;
this
- .GenericApply(__that, __nameScope, ((c9, __that, __nameScope) =>
+ .GenericApply(__that, __nameScope, (ApplyMethod_9 ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_10 ))
+ ;
+ OnInitializeCompleted();
+
+ Bindings = new MainPage_Bindings(this);
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
+ }
+ partial void OnInitializeCompleted();
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.UpdateResources();
+ }
+ private void ApplyMethod_1(global::Microsoft.UI.Xaml.Style __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L7:6");
+ }
+
+ private void ApplyMethod_4(global::Microsoft.UI.Xaml.Style __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L10:6");
+ }
+
+ private void ApplyMethod_6(global::System.Object __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L13:6");
+ }
+
+ private void ApplyMethod_7(global::System.Object __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L42:8");
+ }
+
+ private void ApplyMethod_8(global::Microsoft.UI.Xaml.Controls.ListView __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __nameScope.RegisterName("TheListView", __p1);
+ __that.TheListView = __p1;
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.ListView.ItemTemplateProperty, "MyItemTemplate", isThemeResourceExtension: false, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 40, 4);
+ __p1.CreationComplete();
+ }
+
+ private void ApplyMethod_9(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
// Source 0\MainPage.xaml (Line 1:2)
- // WARNING Property c9.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
- ))
- .GenericApply(__that, __nameScope, ((c10, __that, __nameScope) =>
+
+ private void ApplyMethod_11(global::Microsoft.UI.Xaml.AdaptiveTrigger __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L24:12");
+ }
+
+ private void ApplyMethod_12(global::Microsoft.UI.Xaml.VisualState __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ __nameScope.RegisterName("WideState", __p1);
+ __that.WideState = __p1;
+ global::Uno.UI.Helpers.MarkupHelper.SetVisualStateLazy(__p1, () =>
+ {
+ __p1.Name = "WideState";
+ __p1.Setters.Add(
+ new global::Microsoft.UI.Xaml.Setter
+ {
+ Target = new global::Microsoft.UI.Xaml.TargetPropertyPath(this._TheListViewSubject, "Background"),
+ Value = @"Red",
+ // Source 0\MainPage.xaml (Line 27:12)
+ }
+ );
+ ;
+ }
+ );
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L22:8");
+ }
+
+ private void ApplyMethod_14(global::Microsoft.UI.Xaml.AdaptiveTrigger __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L32:12");
+ }
+
+ private void ApplyMethod_15(global::Microsoft.UI.Xaml.VisualState __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ __nameScope.RegisterName("NarrowState", __p1);
+ __that.NarrowState = __p1;
+ global::Uno.UI.Helpers.MarkupHelper.SetVisualStateLazy(__p1, () =>
+ {
+ __p1.Name = "NarrowState";
+ __p1.Setters.Add(
+ new global::Microsoft.UI.Xaml.Setter
+ {
+ Target = new global::Microsoft.UI.Xaml.TargetPropertyPath(this._TheListViewSubject, "Background"),
+ Value = @"Green",
+ // Source 0\MainPage.xaml (Line 35:12)
+ }
+ );
+ ;
+ }
+ );
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L30:8");
+ }
+
+ private void ApplyMethod_10(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
/* _isTopLevelDictionary:False */
- __that._component_1 = c10;
+ __that._component_1 = __p1;
// Class TestRepro.MainPage
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c10, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Microsoft.UI.Xaml.VisualStateManager.SetVisualStateGroups(c10,
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Microsoft.UI.Xaml.VisualStateManager.SetVisualStateGroups(__p1,
new[]
{
new global::Microsoft.UI.Xaml.VisualStateGroup
@@ -179,37 +252,13 @@ private void InitializeComponent()
MinWindowWidth = 641d,
// Source 0\MainPage.xaml (Line 24:12)
}
- .GenericApply(__that, __nameScope, ((c11, __that, __nameScope) =>
- {
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c11, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L24:12");
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_11 ))
,
}
,
// Source 0\MainPage.xaml (Line 22:8)
}
- .GenericApply(__that, __nameScope, ((c12, __that, __nameScope) =>
- {
- __nameScope.RegisterName("WideState", c12);
- __that.WideState = c12;
- global::Uno.UI.Helpers.MarkupHelper.SetVisualStateLazy(c12, () =>
- {
- c12.Name = "WideState";
- c12.Setters.Add(
- new global::Microsoft.UI.Xaml.Setter
- {
- Target = new global::Microsoft.UI.Xaml.TargetPropertyPath(this._TheListViewSubject, "Background"),
- Value = @"Red",
- // Source 0\MainPage.xaml (Line 27:12)
- }
- );
- ;
- }
- );
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c12, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L22:8");
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_12 ))
,
new global::Microsoft.UI.Xaml.VisualState
{
@@ -221,60 +270,23 @@ private void InitializeComponent()
MinWindowWidth = 0d,
// Source 0\MainPage.xaml (Line 32:12)
}
- .GenericApply(__that, __nameScope, ((c14, __that, __nameScope) =>
- {
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c14, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L32:12");
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_14 ))
,
}
,
// Source 0\MainPage.xaml (Line 30:8)
}
- .GenericApply(__that, __nameScope, ((c15, __that, __nameScope) =>
- {
- __nameScope.RegisterName("NarrowState", c15);
- __that.NarrowState = c15;
- global::Uno.UI.Helpers.MarkupHelper.SetVisualStateLazy(c15, () =>
- {
- c15.Name = "NarrowState";
- c15.Setters.Add(
- new global::Microsoft.UI.Xaml.Setter
- {
- Target = new global::Microsoft.UI.Xaml.TargetPropertyPath(this._TheListViewSubject, "Background"),
- Value = @"Green",
- // Source 0\MainPage.xaml (Line 35:12)
- }
- );
- ;
- }
- );
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c15, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L30:8");
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_15 ))
,
}
}
, }
);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c10, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 1, 2);
- c10.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 1, 2);
+ __p1.CreationComplete();
}
- ))
- ;
- OnInitializeCompleted();
- Bindings = ((IMainPage_Bindings)global::Uno.UI.Helpers.TypeMappings.CreateInstance(this));
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__that, "owner", __that);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- var __that = global::Uno.UI.Helpers.MarkupHelper.GetElementProperty(s, "owner");
- __that.Bindings.UpdateResources();
- }
- ;
- }
- partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Data.ElementNameSubject _TheListViewSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
+ private global::Microsoft.UI.Xaml.Data.ElementNameSubject _TheListViewSubject { get; set; } = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
private global::Microsoft.UI.Xaml.Controls.ListView TheListView
{
get
@@ -286,7 +298,7 @@ private void InitializeComponent()
_TheListViewSubject.ElementInstance = value;
}
}
- private global::Microsoft.UI.Xaml.Data.ElementNameSubject _WideStateSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
+ private global::Microsoft.UI.Xaml.Data.ElementNameSubject _WideStateSubject { get; set; } = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
private global::Microsoft.UI.Xaml.VisualState WideState
{
get
@@ -298,7 +310,7 @@ private void InitializeComponent()
_WideStateSubject.ElementInstance = value;
}
}
- private global::Microsoft.UI.Xaml.Data.ElementNameSubject _NarrowStateSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
+ private global::Microsoft.UI.Xaml.Data.ElementNameSubject _NarrowStateSubject { get; set; } = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
private global::Microsoft.UI.Xaml.VisualState NarrowState
{
get
@@ -310,26 +322,23 @@ private void InitializeComponent()
_NarrowStateSubject.ElementInstance = value;
}
}
- internal interface I_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0
- {
- _View Build(object owner);
- }
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
- private class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 : I_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0
+ private class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
+ global::System.Object __ResourceOwner_1;
+ _View __rootInstance = null;
public _View Build(object __ResourceOwner_1)
{
- _View __rootInstance = null;
var __that = this;
- __rootInstance =
+ this.__ResourceOwner_1 = __ResourceOwner_1;
+ this.__rootInstance =
new global::Microsoft.UI.Xaml.Controls.StackPanel
{
IsParsing = true,
@@ -341,19 +350,7 @@ public _View Build(object __ResourceOwner_1)
IsParsing = true,
// Source 0\MainPage.xaml (Line 15:10)
}
- .GenericApply(__that, __nameScope, ((c17, __that, __nameScope) =>
- {
- c17.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Path = @"",
- }
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c17, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 15, 10);
- c17.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_17 ))
,
new global::Microsoft.UI.Xaml.Controls.Button
{
@@ -361,33 +358,15 @@ public _View Build(object __ResourceOwner_1)
Content = @"DoSomething",
// Source 0\MainPage.xaml (Line 16:10)
}
- .GenericApply(__that, __nameScope, ((c18, __that, __nameScope) =>
- {
- /* _isTopLevelDictionary:False */
- __that._component_0 = c18;
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c18, global::Microsoft.UI.Xaml.Controls.Button.StyleProperty, "MyCustomButtonStyle", isThemeResourceExtension: false, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c18, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 16, 10);
- c18.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_18 ))
,
}
}
- .GenericApply(__that, __nameScope, ((c19, __that, __nameScope) =>
- {
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c19, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 14, 8);
- c19.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_19 ))
;
- if (__rootInstance is FrameworkElement __fe)
+ if (__rootInstance is FrameworkElement __fe)
{
- var owner = this;
- __fe.Loading += delegate
- {
- _component_0.UpdateResourceBindings();
- }
- ;
+ __fe.Loading += __UpdateBindingsAndResources;
}
if (__rootInstance is DependencyObject d)
{
@@ -412,39 +391,64 @@ public _View Build(object __ResourceOwner_1)
_component_0_Holder.Instance = value;
}
}
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ var owner = this;
+ _component_0.UpdateResourceBindings();
+ }
+ private void ApplyMethod_17(global::Microsoft.UI.Xaml.Controls.TextBlock __p1, _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Path = @"",
+ }
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 15, 10);
+ __p1.CreationComplete();
+ }
+
+ private void ApplyMethod_18(global::Microsoft.UI.Xaml.Controls.Button __p1, _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Button.StyleProperty, "MyCustomButtonStyle", isThemeResourceExtension: false, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 16, 10);
+ __p1.CreationComplete();
+ }
+
+ private void ApplyMethod_19(global::Microsoft.UI.Xaml.Controls.StackPanel __p1, _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 14, 8);
+ __p1.CreationComplete();
+ }
+
}
- internal interface I_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC1
- {
- _View Build(object owner);
- }
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
- private class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC1 : I_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC1
+ private class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC1
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
+ global::System.Object __ResourceOwner_1;
+ _View __rootInstance = null;
public _View Build(object __ResourceOwner_1)
{
- _View __rootInstance = null;
var __that = this;
- __rootInstance =
+ this.__ResourceOwner_1 = __ResourceOwner_1;
+ this.__rootInstance =
new global::Microsoft.UI.Xaml.Controls.TextBlock
{
IsParsing = true,
Text = "Header",
// Source 0\MainPage.xaml (Line 43:10)
}
- .GenericApply(__that, __nameScope, ((c20, __that, __nameScope) =>
- {
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c20, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 43, 10);
- c20.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_20 ))
;
if (__rootInstance is DependencyObject d)
{
@@ -457,6 +461,12 @@ public _View Build(object __ResourceOwner_1)
}
return __rootInstance;
}
+ private void ApplyMethod_20(global::Microsoft.UI.Xaml.Controls.TextBlock __p1, _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC1 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 43, 10);
+ __p1.CreationComplete();
+ }
+
}
private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder { get; } = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.ListView _component_0
@@ -493,7 +503,6 @@ private interface IMainPage_Bindings
#pragma warning disable 0169 // Suppress unused field warning in case Bindings is not used.
private IMainPage_Bindings Bindings;
#pragma warning restore 0169
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
private class MainPage_Bindings : IMainPage_Bindings
{
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLR/XamlCodeGenerator_GlobalStaticResources.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLR/XamlCodeGenerator_GlobalStaticResources.cs
index 1efc369d512c..c3128646b018 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLR/XamlCodeGenerator_GlobalStaticResources.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLR/XamlCodeGenerator_GlobalStaticResources.cs
@@ -4,6 +4,7 @@ namespace MyProject
///
/// Contains all the static resources defined for the application
///
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
public sealed partial class GlobalStaticResources
{
static bool _initialized;
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLR/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLR/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 14d428a2c00b..b23afc309341 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLR/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLR/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -34,11 +34,8 @@
namespace TestRepro
{
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- internal string __checksum() => "d65e560961295873ce5fb238ed21e219474df252";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
@@ -46,12 +43,6 @@ partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page
private global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
private void InitializeComponent()
{
- var __resourceLocator = new global::System.Uri("file:///C:/Project/0/MainPage.xaml");
- if(global::Uno.UI.ApplicationHelper.IsLoadableComponent(__resourceLocator))
- {
- global::Microsoft.UI.Xaml.Application.LoadComponent(this, __resourceLocator);
- return;
- }
NameScope.SetNameScope(this, __nameScope);
var __that = this;
base.IsParsing = true;
@@ -59,64 +50,64 @@ private void InitializeComponent()
typeof(global::Microsoft.UI.Xaml.Controls.TextBlock)
] =
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
- new global::Microsoft.UI.Xaml.Style
- {
- TargetType = typeof(global::Microsoft.UI.Xaml.Controls.TextBlock),
- // Source 0\MainPage.xaml (Line 7:6)
- Setters =
+ {
+ return
+ new global::Microsoft.UI.Xaml.Style
{
- new global::Microsoft.UI.Xaml.Setter
+ TargetType = typeof(global::Microsoft.UI.Xaml.Controls.TextBlock),
+ // Source 0\MainPage.xaml (Line 7:6)
+ Setters =
{
- Property = global::Microsoft.UI.Xaml.Controls.TextBlock.ForegroundProperty,
- Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Red),
- // Source 0\MainPage.xaml (Line 8:8)
+ new global::Microsoft.UI.Xaml.Setter
+ {
+ Property = global::Microsoft.UI.Xaml.Controls.TextBlock.ForegroundProperty,
+ Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Red),
+ // Source 0\MainPage.xaml (Line 8:8)
+ }
+ ,
}
- ,
}
- }
- .GenericApply(__that, __nameScope, ((c1, __that, __nameScope) =>
- {
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L7:6");
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_1 ))
+ ;
+ }
)
;
Resources[
"MyCustomButtonStyle"
] =
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
- new global::Microsoft.UI.Xaml.Style
- {
- TargetType = typeof(global::Microsoft.UI.Xaml.Controls.Button),
- // Source 0\MainPage.xaml (Line 10:6)
- Setters =
+ {
+ return
+ new global::Microsoft.UI.Xaml.Style
{
- new global::Microsoft.UI.Xaml.Setter
+ TargetType = typeof(global::Microsoft.UI.Xaml.Controls.Button),
+ // Source 0\MainPage.xaml (Line 10:6)
+ Setters =
{
- Property = global::Microsoft.UI.Xaml.Controls.Button.BackgroundProperty,
- Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Azure),
- // Source 0\MainPage.xaml (Line 11:8)
+ new global::Microsoft.UI.Xaml.Setter
+ {
+ Property = global::Microsoft.UI.Xaml.Controls.Button.BackgroundProperty,
+ Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Azure),
+ // Source 0\MainPage.xaml (Line 11:8)
+ }
+ ,
}
- ,
}
- }
- .GenericApply(__that, __nameScope, ((c4, __that, __nameScope) =>
- {
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c4, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L10:6");
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_4 ))
+ ;
+ }
)
;
Resources[
"MyItemTemplate"
] =
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
- new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => ((I_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0)global::Uno.UI.Helpers.TypeMappings.CreateInstance<_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0>()).Build(__owner)
- ) .GenericApply(__that, __nameScope, ((c6, __that, __nameScope) =>
- {
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c6, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L13:6");
- }
- ))
+ {
+ return
+ new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0().Build(__owner)
+ ) .GenericApply(__that, __nameScope, (ApplyMethod_6 ))
+ ;
+ }
)
;
// Source 0\MainPage.xaml (Line 1:2)
@@ -126,65 +117,78 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 20:4)
}
- .GenericApply(__that, __nameScope, ((c7, __that, __nameScope) =>
- {
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c7, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 20, 4);
- c7.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_7 ))
;
this
- .GenericApply(__that, __nameScope, ((c8, __that, __nameScope) =>
+ .GenericApply(__that, __nameScope, (ApplyMethod_8 ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_9 ))
+ ;
+ OnInitializeCompleted();
+
+ Bindings = new MainPage_Bindings(this);
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
+ }
+ partial void OnInitializeCompleted();
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.UpdateResources();
+ }
+ private void ApplyMethod_1(global::Microsoft.UI.Xaml.Style __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L7:6");
+ }
+
+ private void ApplyMethod_4(global::Microsoft.UI.Xaml.Style __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L10:6");
+ }
+
+ private void ApplyMethod_6(global::System.Object __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L13:6");
+ }
+
+ private void ApplyMethod_7(global::Microsoft.UI.Xaml.Controls.ListView __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 20, 4);
+ __p1.CreationComplete();
+ }
+
+ private void ApplyMethod_8(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
// Source 0\MainPage.xaml (Line 1:2)
- // WARNING Property c8.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
- ))
- .GenericApply(__that, __nameScope, ((c9, __that, __nameScope) =>
+
+ private void ApplyMethod_9(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
/* _isTopLevelDictionary:False */
- __that._component_0 = c9;
+ __that._component_0 = __p1;
// Class TestRepro.MainPage
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c9, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c9, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 1, 2);
- c9.CreationComplete();
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 1, 2);
+ __p1.CreationComplete();
}
- ))
- ;
- OnInitializeCompleted();
- Bindings = ((IMainPage_Bindings)global::Uno.UI.Helpers.TypeMappings.CreateInstance(this));
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__that, "owner", __that);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- var __that = global::Uno.UI.Helpers.MarkupHelper.GetElementProperty(s, "owner");
- __that.Bindings.UpdateResources();
- }
- ;
- }
- partial void OnInitializeCompleted();
- internal interface I_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0
- {
- _View Build(object owner);
- }
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
- private class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 : I_MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0
+ private class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
+ global::System.Object __ResourceOwner_1;
+ _View __rootInstance = null;
public _View Build(object __ResourceOwner_1)
{
- _View __rootInstance = null;
var __that = this;
- __rootInstance =
+ this.__ResourceOwner_1 = __ResourceOwner_1;
+ this.__rootInstance =
new global::Microsoft.UI.Xaml.Controls.StackPanel
{
IsParsing = true,
@@ -196,19 +200,7 @@ public _View Build(object __ResourceOwner_1)
IsParsing = true,
// Source 0\MainPage.xaml (Line 15:10)
}
- .GenericApply(__that, __nameScope, ((c10, __that, __nameScope) =>
- {
- c10.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Path = @"",
- }
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c10, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 15, 10);
- c10.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_10 ))
,
new global::Microsoft.UI.Xaml.Controls.Button
{
@@ -216,33 +208,15 @@ public _View Build(object __ResourceOwner_1)
Content = @"DoSomething",
// Source 0\MainPage.xaml (Line 16:10)
}
- .GenericApply(__that, __nameScope, ((c11, __that, __nameScope) =>
- {
- /* _isTopLevelDictionary:False */
- __that._component_0 = c11;
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c11, global::Microsoft.UI.Xaml.Controls.Button.StyleProperty, "MyCustomButtonStyle", isThemeResourceExtension: false, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c11, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 16, 10);
- c11.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_11 ))
,
}
}
- .GenericApply(__that, __nameScope, ((c12, __that, __nameScope) =>
- {
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c12, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 14, 8);
- c12.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_12 ))
;
- if (__rootInstance is FrameworkElement __fe)
+ if (__rootInstance is FrameworkElement __fe)
{
- var owner = this;
- __fe.Loading += delegate
- {
- _component_0.UpdateResourceBindings();
- }
- ;
+ __fe.Loading += __UpdateBindingsAndResources;
}
if (__rootInstance is DependencyObject d)
{
@@ -267,6 +241,39 @@ public _View Build(object __ResourceOwner_1)
_component_0_Holder.Instance = value;
}
}
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ var owner = this;
+ _component_0.UpdateResourceBindings();
+ }
+ private void ApplyMethod_10(global::Microsoft.UI.Xaml.Controls.TextBlock __p1, _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Path = @"",
+ }
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 15, 10);
+ __p1.CreationComplete();
+ }
+
+ private void ApplyMethod_11(global::Microsoft.UI.Xaml.Controls.Button __p1, _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Button.StyleProperty, "MyCustomButtonStyle", isThemeResourceExtension: false, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 16, 10);
+ __p1.CreationComplete();
+ }
+
+ private void ApplyMethod_12(global::Microsoft.UI.Xaml.Controls.StackPanel __p1, _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 14, 8);
+ __p1.CreationComplete();
+ }
+
}
private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder { get; } = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Page _component_0
@@ -291,7 +298,6 @@ private interface IMainPage_Bindings
#pragma warning disable 0169 // Suppress unused field warning in case Bindings is not used.
private IMainPage_Bindings Bindings;
#pragma warning restore 0169
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
private class MainPage_Bindings : IMainPage_Bindings
{
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLS/XamlCodeGenerator_GlobalStaticResources.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLS/XamlCodeGenerator_GlobalStaticResources.cs
index 1efc369d512c..c3128646b018 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLS/XamlCodeGenerator_GlobalStaticResources.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLS/XamlCodeGenerator_GlobalStaticResources.cs
@@ -4,6 +4,7 @@ namespace MyProject
///
/// Contains all the static resources defined for the application
///
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
public sealed partial class GlobalStaticResources
{
static bool _initialized;
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 00be0c571d11..85f788efadce 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFPLS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -34,11 +34,8 @@
namespace TestRepro
{
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- internal string __checksum() => "3342e09da9b0007e915ae08b62408423c424b95b";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
@@ -46,12 +43,6 @@ partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page
private global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
private void InitializeComponent()
{
- var __resourceLocator = new global::System.Uri("file:///C:/Project/0/MainPage.xaml");
- if(global::Uno.UI.ApplicationHelper.IsLoadableComponent(__resourceLocator))
- {
- global::Microsoft.UI.Xaml.Application.LoadComponent(this, __resourceLocator);
- return;
- }
NameScope.SetNameScope(this, __nameScope);
var __that = this;
base.IsParsing = true;
@@ -59,52 +50,52 @@ private void InitializeComponent()
typeof(global::Microsoft.UI.Xaml.Controls.TextBlock)
] =
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
- new global::Microsoft.UI.Xaml.Style
- {
- TargetType = typeof(global::Microsoft.UI.Xaml.Controls.TextBlock),
- // Source 0\MainPage.xaml (Line 7:6)
- Setters =
+ {
+ return
+ new global::Microsoft.UI.Xaml.Style
{
- new global::Microsoft.UI.Xaml.Setter
+ TargetType = typeof(global::Microsoft.UI.Xaml.Controls.TextBlock),
+ // Source 0\MainPage.xaml (Line 7:6)
+ Setters =
{
- Property = global::Microsoft.UI.Xaml.Controls.TextBlock.ForegroundProperty,
- Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Red),
- // Source 0\MainPage.xaml (Line 8:8)
+ new global::Microsoft.UI.Xaml.Setter
+ {
+ Property = global::Microsoft.UI.Xaml.Controls.TextBlock.ForegroundProperty,
+ Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Red),
+ // Source 0\MainPage.xaml (Line 8:8)
+ }
+ ,
}
- ,
}
- }
- .GenericApply(__that, __nameScope, ((c1, __that, __nameScope) =>
- {
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L7:6");
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_1 ))
+ ;
+ }
)
;
Resources[
"MyCustomButtonStyle"
] =
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
- new global::Microsoft.UI.Xaml.Style
- {
- TargetType = typeof(global::Microsoft.UI.Xaml.Controls.Button),
- // Source 0\MainPage.xaml (Line 10:6)
- Setters =
+ {
+ return
+ new global::Microsoft.UI.Xaml.Style
{
- new global::Microsoft.UI.Xaml.Setter
+ TargetType = typeof(global::Microsoft.UI.Xaml.Controls.Button),
+ // Source 0\MainPage.xaml (Line 10:6)
+ Setters =
{
- Property = global::Microsoft.UI.Xaml.Controls.Button.BackgroundProperty,
- Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Azure),
- // Source 0\MainPage.xaml (Line 11:8)
+ new global::Microsoft.UI.Xaml.Setter
+ {
+ Property = global::Microsoft.UI.Xaml.Controls.Button.BackgroundProperty,
+ Value = new global::Microsoft.UI.Xaml.Media.SolidColorBrush(global::Microsoft.UI.Colors.Azure),
+ // Source 0\MainPage.xaml (Line 11:8)
+ }
+ ,
}
- ,
}
- }
- .GenericApply(__that, __nameScope, ((c4, __that, __nameScope) =>
- {
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(c4, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L10:6");
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_4 ))
+ ;
+ }
)
;
// Source 0\MainPage.xaml (Line 1:2)
@@ -114,45 +105,56 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 14:4)
}
- .GenericApply(__that, __nameScope, ((c6, __that, __nameScope) =>
- {
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c6, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 14, 4);
- c6.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_6 ))
;
this
- .GenericApply(__that, __nameScope, ((c7, __that, __nameScope) =>
+ .GenericApply(__that, __nameScope, (ApplyMethod_7 ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_8 ))
+ ;
+ OnInitializeCompleted();
+
+ Bindings = new MainPage_Bindings(this);
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
+ }
+ partial void OnInitializeCompleted();
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.UpdateResources();
+ }
+ private void ApplyMethod_1(global::Microsoft.UI.Xaml.Style __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L7:6");
+ }
+
+ private void ApplyMethod_4(global::Microsoft.UI.Xaml.Style __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/MainPage.xaml#L10:6");
+ }
+
+ private void ApplyMethod_6(global::Microsoft.UI.Xaml.Controls.ListView __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 14, 4);
+ __p1.CreationComplete();
+ }
+
+ private void ApplyMethod_7(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
// Source 0\MainPage.xaml (Line 1:2)
- // WARNING Property c7.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
- ))
- .GenericApply(__that, __nameScope, ((c8, __that, __nameScope) =>
+
+ private void ApplyMethod_8(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
/* _isTopLevelDictionary:False */
- __that._component_0 = c8;
+ __that._component_0 = __p1;
// Class TestRepro.MainPage
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c8, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c8, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 1, 2);
- c8.CreationComplete();
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 1, 2);
+ __p1.CreationComplete();
}
- ))
- ;
- OnInitializeCompleted();
- Bindings = ((IMainPage_Bindings)global::Uno.UI.Helpers.TypeMappings.CreateInstance(this));
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__that, "owner", __that);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- var __that = global::Uno.UI.Helpers.MarkupHelper.GetElementProperty(s, "owner");
- __that.Bindings.UpdateResources();
- }
- ;
- }
- partial void OnInitializeCompleted();
private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder { get; } = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Page _component_0
{
@@ -176,7 +178,6 @@ private interface IMainPage_Bindings
#pragma warning disable 0169 // Suppress unused field warning in case Bindings is not used.
private IMainPage_Bindings Bindings;
#pragma warning restore 0169
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
private class MainPage_Bindings : IMainPage_Bindings
{
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFRT/XamlCodeGenerator_GlobalStaticResources.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFRT/XamlCodeGenerator_GlobalStaticResources.cs
index 1efc369d512c..c3128646b018 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFRT/XamlCodeGenerator_GlobalStaticResources.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFRT/XamlCodeGenerator_GlobalStaticResources.cs
@@ -4,6 +4,7 @@ namespace MyProject
///
/// Contains all the static resources defined for the application
///
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
public sealed partial class GlobalStaticResources
{
static bool _initialized;
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFRT/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFRT/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 25d9f901aaf7..c1e61bc48c8c 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFRT/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFRT/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -34,11 +34,8 @@
namespace TestRepro
{
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page
{
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- internal string __checksum() => "09e2aaf9274c57d3e9cf35f1ca51514a3a6916ed";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
@@ -46,12 +43,6 @@ partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page
private global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
private void InitializeComponent()
{
- var __resourceLocator = new global::System.Uri("file:///C:/Project/0/MainPage.xaml");
- if(global::Uno.UI.ApplicationHelper.IsLoadableComponent(__resourceLocator))
- {
- global::Microsoft.UI.Xaml.Application.LoadComponent(this, __resourceLocator);
- return;
- }
NameScope.SetNameScope(this, __nameScope);
var __that = this;
base.IsParsing = true;
@@ -74,12 +65,7 @@ private void InitializeComponent()
Text = "use me",
// Source 0\MainPage.xaml (Line 9:3)
}
- .GenericApply(__that, __nameScope, ((c0, __that, __nameScope) =>
- {
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 9, 3);
- c0.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_0 ))
;
// Source 0\MainPage.xaml (Line 1:2)
base.Content =
@@ -89,45 +75,52 @@ private void InitializeComponent()
Text = "Some content",
// Source 0\MainPage.xaml (Line 11:4)
}
- .GenericApply(__that, __nameScope, ((c1, __that, __nameScope) =>
- {
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 11, 4);
- c1.CreationComplete();
- }
- ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_1 ))
;
this
- .GenericApply(__that, __nameScope, ((c2, __that, __nameScope) =>
+ .GenericApply(__that, __nameScope, (ApplyMethod_2 ))
+ .GenericApply(__that, __nameScope, (ApplyMethod_3 ))
+ ;
+ OnInitializeCompleted();
+
+ Bindings = new MainPage_Bindings(this);
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
+ }
+ partial void OnInitializeCompleted();
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.UpdateResources();
+ }
+ private void ApplyMethod_0(global::Microsoft.UI.Xaml.Controls.TextBlock __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 9, 3);
+ __p1.CreationComplete();
+ }
+
+ private void ApplyMethod_1(global::Microsoft.UI.Xaml.Controls.TextBlock __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
+ {
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 11, 4);
+ __p1.CreationComplete();
+ }
+
+ private void ApplyMethod_2(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
// Source 0\MainPage.xaml (Line 1:2)
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
- ))
- .GenericApply(__that, __nameScope, ((c3, __that, __nameScope) =>
+
+ private void ApplyMethod_3(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPage __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
/* _isTopLevelDictionary:False */
- __that._component_0 = c3;
+ __that._component_0 = __p1;
// Class TestRepro.MainPage
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c3, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 1, 2);
- c3.CreationComplete();
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d, "file:///C:/Project/0/MainPage.xaml", 1, 2);
+ __p1.CreationComplete();
}
- ))
- ;
- OnInitializeCompleted();
- Bindings = ((IMainPage_Bindings)global::Uno.UI.Helpers.TypeMappings.CreateInstance(this));
- global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__that, "owner", __that);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- var __that = global::Uno.UI.Helpers.MarkupHelper.GetElementProperty(s, "owner");
- __that.Bindings.UpdateResources();
- }
- ;
- }
- partial void OnInitializeCompleted();
private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder { get; } = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Page _component_0
{
@@ -151,7 +144,6 @@ private interface IMainPage_Bindings
#pragma warning disable 0169 // Suppress unused field warning in case Bindings is not used.
private IMainPage_Bindings Bindings;
#pragma warning restore 0169
- [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
private class MainPage_Bindings : IMainPage_Bindings
{
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFTLRD/XamlCodeGenerator_GlobalStaticResources.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFTLRD/XamlCodeGenerator_GlobalStaticResources.cs
index 15ab9e0d8660..2742f4391268 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFTLRD/XamlCodeGenerator_GlobalStaticResources.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFTLRD/XamlCodeGenerator_GlobalStaticResources.cs
@@ -4,6 +4,7 @@ namespace MyProject
///
/// Contains all the static resources defined for the application
///
+ [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
public sealed partial class GlobalStaticResources
{
static bool _initialized;
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFTLRD/XamlCodeGenerator_MyDictionary_b7707bcf1e73425b710b6a5d04177088.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFTLRD/XamlCodeGenerator_MyDictionary_b7707bcf1e73425b710b6a5d04177088.cs
index 5d32651d4962..609b3797756e 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFTLRD/XamlCodeGenerator_MyDictionary_b7707bcf1e73425b710b6a5d04177088.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/SOSLIOFTLRD/XamlCodeGenerator_MyDictionary_b7707bcf1e73425b710b6a5d04177088.cs
@@ -58,9 +58,9 @@ public sealed partial class GlobalStaticResources
private const string __baseUri_prefix_MyDictionary_b7707bcf1e73425b710b6a5d04177088 = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_MyDictionary_b7707bcf1e73425b710b6a5d04177088 = "ms-appx:///TestProject/";
+ // This non-static inner class is a means of reducing size of AOT compilations by avoiding many accesses to static members from a static callsite, which adds costly class initializer checks each time.
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
internal string __MyDictionary_b7707bcf1e73425b710b6a5d04177088_checksum() => "0006bfa967d7b0e0bdb0aa951326268f007434d5";
- // This non-static inner class is a means of reducing size of AOT compilations by avoiding many accesses to static members from a static callsite, which adds costly class initializer checks each time.
[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
internal sealed class ResourceDictionarySingleton__MyDictionary_b7707bcf1e73425b710b6a5d04177088 : global::Uno.UI.IXamlResourceDictionaryProvider
{
@@ -72,7 +72,7 @@ internal sealed class ResourceDictionarySingleton__MyDictionary_b7707bcf1e73425b
{
if (__that == null)
{
- __that = (global::Uno.UI.IXamlResourceDictionaryProvider)global::Uno.UI.Helpers.TypeMappings.CreateInstance();
+ __that = new ResourceDictionarySingleton__MyDictionary_b7707bcf1e73425b710b6a5d04177088();
}
return __that;
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TAA/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TAA/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 525ffc8e395f..ae0cdd46d8c3 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TAA/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TAA/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -59,64 +59,64 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 12:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = BindingMode.OneTime,
- }
- .BindingApply(___b => /*defaultBindModeOneTime MyArray.Length*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? (TryGetInstance_xBind_1(___tctx, out var bindResult1) ? (true, bindResult1) : (false, default)) : (false, default), null ))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = BindingMode.OneTime,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime MyArray.Length*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? (TryGetInstance_xBind_1(___tctx, out var bindResult1) ? (true, bindResult1) : (false, default)) : (false, default), null ))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_1 = c3;
- // Class TestRepro.MainPage
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c3, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_1 = __p1;
+ // Class TestRepro.MainPage
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -128,7 +128,7 @@ private void InitializeComponent()
_component_0_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Page _component_1
{
get
@@ -213,5 +213,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TBTNSICB/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TBTNSICB/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index d174782f553a..4f97d3c0a537 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TBTNSICB/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TBTNSICB/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -62,10 +62,10 @@ private void InitializeComponent()
FontSize = 30d,
// Source 0\MainPage.xaml (Line 12:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -73,58 +73,58 @@ private void InitializeComponent()
{
// Source 0\MainPage.xaml (Line 13:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- c1.SetBinding(
- "DataContext",
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Path = @"PreviewDropViewModel",
- }
- );
+ __p1.SetBinding(
+ "DataContext",
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Path = @"PreviewDropViewModel",
+ }
+ );
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(c2 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c3.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c4) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c4;
- // Class TestRepro.MainPage
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c4, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c4, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c4.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ // Class TestRepro.MainPage
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Page _component_0
{
get
@@ -206,5 +206,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler3(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler3 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TBTNSICB/XamlCodeGenerator_UserControl1_81d855d5b3bba02f594dcda3b149beb2.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TBTNSICB/XamlCodeGenerator_UserControl1_81d855d5b3bba02f594dcda3b149beb2.cs
index 8bbfc030fecc..4003dff8ad3e 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TBTNSICB/XamlCodeGenerator_UserControl1_81d855d5b3bba02f594dcda3b149beb2.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TBTNSICB/XamlCodeGenerator_UserControl1_81d855d5b3bba02f594dcda3b149beb2.cs
@@ -53,27 +53,27 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\UserControl1.xaml (Line 12:3)
}
- .UserControl1_81d855d5b3bba02f594dcda3b149beb2_XamlApply((UserControl1_81d855d5b3bba02f594dcda3b149beb2XamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .UserControl1_81d855d5b3bba02f594dcda3b149beb2_XamlApply((UserControl1_81d855d5b3bba02f594dcda3b149beb2XamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_UserControl1_81d855d5b3bba02f594dcda3b149beb2);
- c0.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_UserControl1_81d855d5b3bba02f594dcda3b149beb2);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c1) =>
+ .UserControl1_81d855d5b3bba02f594dcda3b149beb2_XamlApply((UserControl1_81d855d5b3bba02f594dcda3b149beb2XamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Source 0\UserControl1.xaml (Line 1:2)
-
- // WARNING Property c1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}UserControl, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\UserControl1.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}UserControl, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c2) =>
+ .UserControl1_81d855d5b3bba02f594dcda3b149beb2_XamlApply((UserControl1_81d855d5b3bba02f594dcda3b149beb2XamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Class TestRepro.UserControl1
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_UserControl1_81d855d5b3bba02f594dcda3b149beb2);
- c2.CreationComplete();
+ // Class TestRepro.UserControl1
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_UserControl1_81d855d5b3bba02f594dcda3b149beb2);
+ __p1.CreationComplete();
}
))
;
@@ -94,5 +94,12 @@ static class UserControl1_81d855d5b3bba02f594dcda3b149beb2XamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler1(global::Microsoft.UI.Xaml.Controls.UserControl instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.UserControl UserControl1_81d855d5b3bba02f594dcda3b149beb2_XamlApply(this global::Microsoft.UI.Xaml.Controls.UserControl instance, XamlApplyHandler1 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TDBMIDTIRD/XamlCodeGenerator_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TDBMIDTIRD/XamlCodeGenerator_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57.cs
index 74e5d4ef1a2e..c7541b4efd5a 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TDBMIDTIRD/XamlCodeGenerator_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TDBMIDTIRD/XamlCodeGenerator_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57.cs
@@ -46,60 +46,60 @@ public void InitializeComponent()
"myTemplate"
] =
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
- new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_TestReproMyResourceDictionarySC0().Build(__owner)
- ) )
+ {
+ return
+ new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_TestReproMyResourceDictionarySC0().Build(__owner)
+ ) ;
+ }
+ )
;
}
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
- private class _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_TestReproMyResourceDictionarySC0
+ private class _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_TestReproMyResourceDictionarySC0
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57 = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57 = "ms-appx:///TestProject/";
global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
+ global::System.Object __ResourceOwner_1;
+ _View __rootInstance = null;
public _View Build(object __ResourceOwner_1)
{
- _View __rootInstance = null;
var __that = this;
- __rootInstance =
+ this.__ResourceOwner_1 = __ResourceOwner_1;
+ this.__rootInstance =
new global::Microsoft.UI.Xaml.Controls.TextBlock
{
IsParsing = true,
Name = "tb",
// Source 0\MyResourceDictionary.xaml (Line 12:5)
}
- .MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_XamlApply((MyResourceDictionary_92716e07ff456818f6d4125e055d4d57XamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_XamlApply((MyResourceDictionary_92716e07ff456818f6d4125e055d4d57XamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:True */
- __that._component_0 = c0;
- __nameScope.RegisterName("tb", c0);
- __that.tb = c0;
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = BindingMode.OneWay,
- }
- .BindingApply(___b => /*defaultBindModeOneWay*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, null, ___ctx => ___ctx is global::TestRepro.MyModel ___tctx ? (TryGetInstance_xBind_1(___tctx, out var bindResult1) ? (true, bindResult1) : (false, default)) : (false, default), null , new [] {"MyString"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:True */
+ __that._component_0 = __p1;
+ __nameScope.RegisterName("tb", __p1);
+ __that.tb = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = BindingMode.OneWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneWay*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, null, ___ctx => ___ctx is global::TestRepro.MyModel ___tctx ? (TryGetInstance_xBind_1(___tctx, out var bindResult1) ? (true, bindResult1) : (false, default)) : (false, default), null , new [] {"MyString"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57);
+ __p1.CreationComplete();
}
))
;
- if (__rootInstance is FrameworkElement __fe)
+ if (__rootInstance is FrameworkElement __fe)
{
- var owner = this;
- __fe.Loading += delegate
- {
- _component_0.UpdateResourceBindings();
- _component_0.ApplyXBind();
- }
- ;
+ __fe.Loading += __UpdateBindingsAndResources;
}
if (__rootInstance is DependencyObject d)
{
@@ -112,7 +112,7 @@ public _View Build(object __ResourceOwner_1)
}
return __rootInstance;
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -136,6 +136,12 @@ public _View Build(object __ResourceOwner_1)
_tbSubject.ElementInstance = value;
}
}
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ var owner = this;
+ _component_0.UpdateResourceBindings();
+ _component_0.ApplyXBind();
+ }
private static bool TryGetInstance_xBind_1(global::TestRepro.MyModel ___tctx, out object o)
{
o = null;
@@ -204,8 +210,12 @@ private object Get_1(object __ResourceOwner_1) =>
"myTemplate"
] =
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
- new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new __Resources._MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRDSC2().Build(__owner)
- ) )
+ {
+ return
+ new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new __Resources._MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRDSC2().Build(__owner)
+ ) ;
+ }
+ )
,
}
;
@@ -227,52 +237,48 @@ namespace MyProject.__Resources
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
- class _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRDSC1
+ class _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRDSC1
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57 = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57 = "ms-appx:///TestProject/";
global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
+ global::System.Object __ResourceOwner_1;
+ _View __rootInstance = null;
public _View Build(object __ResourceOwner_1)
{
- _View __rootInstance = null;
var __that = this;
- __rootInstance =
+ this.__ResourceOwner_1 = __ResourceOwner_1;
+ this.__rootInstance =
new global::Microsoft.UI.Xaml.Controls.TextBlock
{
IsParsing = true,
Name = "tb",
// Source 0\MyResourceDictionary.xaml (Line 12:5)
}
- .MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_XamlApply((MyResourceDictionary_92716e07ff456818f6d4125e055d4d57XamlApplyExtensions.XamlApplyHandler0)(c1 =>
+ .MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_XamlApply((MyResourceDictionary_92716e07ff456818f6d4125e055d4d57XamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:True */
- __that._component_0 = c1;
- __nameScope.RegisterName("tb", c1);
- __that.tb = c1;
- c1.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = BindingMode.OneWay,
- }
- .BindingApply(___b => /*defaultBindModeOneWay*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, null, ___ctx => ___ctx is global::TestRepro.MyModel ___tctx ? (TryGetInstance_xBind_2(___tctx, out var bindResult2) ? (true, bindResult2) : (false, default)) : (false, default), null , new [] {"MyString"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57);
- c1.CreationComplete();
+ /* _isTopLevelDictionary:True */
+ __that._component_0 = __p1;
+ __nameScope.RegisterName("tb", __p1);
+ __that.tb = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = BindingMode.OneWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneWay*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, null, ___ctx => ___ctx is global::TestRepro.MyModel ___tctx ? (TryGetInstance_xBind_2(___tctx, out var bindResult2) ? (true, bindResult2) : (false, default)) : (false, default), null , new [] {"MyString"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57);
+ __p1.CreationComplete();
}
))
;
- if (__rootInstance is FrameworkElement __fe)
+ if (__rootInstance is FrameworkElement __fe)
{
- var owner = this;
- __fe.Loading += delegate
- {
- _component_0.UpdateResourceBindings();
- _component_0.ApplyXBind();
- }
- ;
+ __fe.Loading += __UpdateBindingsAndResources;
}
if (__rootInstance is DependencyObject d)
{
@@ -285,7 +291,7 @@ public _View Build(object __ResourceOwner_1)
}
return __rootInstance;
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -309,6 +315,12 @@ public _View Build(object __ResourceOwner_1)
_tbSubject.ElementInstance = value;
}
}
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ var owner = this;
+ _component_0.UpdateResourceBindings();
+ _component_0.ApplyXBind();
+ }
private static bool TryGetInstance_xBind_2(global::TestRepro.MyModel ___tctx, out object o)
{
o = null;
@@ -319,52 +331,48 @@ private static bool TryGetInstance_xBind_2(global::TestRepro.MyModel ___tctx, ou
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
- class _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRDSC2
+ class _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRDSC2
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57 = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57 = "ms-appx:///TestProject/";
global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
+ global::System.Object __ResourceOwner_1;
+ _View __rootInstance = null;
public _View Build(object __ResourceOwner_1)
{
- _View __rootInstance = null;
var __that = this;
- __rootInstance =
+ this.__ResourceOwner_1 = __ResourceOwner_1;
+ this.__rootInstance =
new global::Microsoft.UI.Xaml.Controls.TextBlock
{
IsParsing = true,
Name = "tb",
// Source 0\MyResourceDictionary.xaml (Line 12:5)
}
- .MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_XamlApply((MyResourceDictionary_92716e07ff456818f6d4125e055d4d57XamlApplyExtensions.XamlApplyHandler0)(c2 =>
+ .MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_XamlApply((MyResourceDictionary_92716e07ff456818f6d4125e055d4d57XamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:True */
- __that._component_0 = c2;
- __nameScope.RegisterName("tb", c2);
- __that.tb = c2;
- c2.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = BindingMode.OneWay,
- }
- .BindingApply(___b => /*defaultBindModeOneWay*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, null, ___ctx => ___ctx is global::TestRepro.MyModel ___tctx ? (TryGetInstance_xBind_3(___tctx, out var bindResult3) ? (true, bindResult3) : (false, default)) : (false, default), null , new [] {"MyString"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57);
- c2.CreationComplete();
+ /* _isTopLevelDictionary:True */
+ __that._component_0 = __p1;
+ __nameScope.RegisterName("tb", __p1);
+ __that.tb = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = BindingMode.OneWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneWay*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, null, ___ctx => ___ctx is global::TestRepro.MyModel ___tctx ? (TryGetInstance_xBind_3(___tctx, out var bindResult3) ? (true, bindResult3) : (false, default)) : (false, default), null , new [] {"MyString"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57);
+ __p1.CreationComplete();
}
))
;
- if (__rootInstance is FrameworkElement __fe)
+ if (__rootInstance is FrameworkElement __fe)
{
- var owner = this;
- __fe.Loading += delegate
- {
- _component_0.UpdateResourceBindings();
- _component_0.ApplyXBind();
- }
- ;
+ __fe.Loading += __UpdateBindingsAndResources;
}
if (__rootInstance is DependencyObject d)
{
@@ -377,7 +385,7 @@ public _View Build(object __ResourceOwner_1)
}
return __rootInstance;
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -401,6 +409,12 @@ public _View Build(object __ResourceOwner_1)
_tbSubject.ElementInstance = value;
}
}
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ var owner = this;
+ _component_0.UpdateResourceBindings();
+ _component_0.ApplyXBind();
+ }
private static bool TryGetInstance_xBind_3(global::TestRepro.MyModel ___tctx, out object o)
{
o = null;
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TIDFA/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TIDFA/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index d2c3ad9a4a47..659994de7711 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TIDFA/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TIDFA/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -59,61 +59,61 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 11:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBox.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime MyFooInterface.Name*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.MyFooInterface.Name)) : (false, default), (___ctx, __value) => { if(___ctx is global::TestRepro.MainPage ___tctx) ___tctx.MyFooInterface.Name = (string)global::Microsoft.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(string), __value); } , new [] {"MyFooInterface.Name"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBox.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime MyFooInterface.Name*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.MyFooInterface.Name)) : (false, default), (___ctx, __value) => { if(___ctx is global::TestRepro.MainPage ___tctx) ___tctx.MyFooInterface.Name = (string)global::Microsoft.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(string), __value); } , new [] {"MyFooInterface.Name"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBox _component_0
{
get
@@ -189,5 +189,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TIM/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TIM/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 0afbaaaa9257..323de5cb709d 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TIM/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TIM/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -59,22 +59,22 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 12:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- __that.__0_Click_P1_Button_Click_Builder = (__owner) =>
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __that.__0_Click_P1_Button_Click_Builder = (__owner) =>
+ {
+ var Click_P1_Button_Click_That = (__that as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
+ /* first level targetMethod:TestRepro.C1.Button_Click(object, Microsoft.UI.Xaml.RoutedEventArgs) */ __owner.Click += (_sender,_e) =>
{
- var Click_P1_Button_Click_That = (__that as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
- /* first level targetMethod:TestRepro.C1.Button_Click(object, Microsoft.UI.Xaml.RoutedEventArgs) */ __owner.Click += (_sender,_e) =>
- {
- (Click_P1_Button_Click_That.Target as global::TestRepro.MainPage)?.P1.Button_Click(_sender,_e);
- }
- ;
+ (Click_P1_Button_Click_That.Target as global::TestRepro.MainPage)?.P1.Button_Click(_sender,_e);
}
;
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ }
+ ;
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -83,22 +83,22 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 13:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
+ {
+ /* _isTopLevelDictionary:False */
+ __that._component_1 = __p1;
+ __that.__1_Click_P2_Button_Click_Builder = (__owner) =>
{
- /* _isTopLevelDictionary:False */
- __that._component_1 = c1;
- __that.__1_Click_P2_Button_Click_Builder = (__owner) =>
+ var Click_P2_Button_Click_That = (__that as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
+ /* first level targetMethod:TestRepro.ImplicitImpl.Button_Click(object, Microsoft.UI.Xaml.RoutedEventArgs) */ __owner.Click += (_sender,_e) =>
{
- var Click_P2_Button_Click_That = (__that as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
- /* first level targetMethod:TestRepro.ImplicitImpl.Button_Click(object, Microsoft.UI.Xaml.RoutedEventArgs) */ __owner.Click += (_sender,_e) =>
- {
- (Click_P2_Button_Click_That.Target as global::TestRepro.MainPage)?.P2.Button_Click(_sender,_e);
- }
- ;
+ (Click_P2_Button_Click_That.Target as global::TestRepro.MainPage)?.P2.Button_Click(_sender,_e);
}
;
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ }
+ ;
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -107,69 +107,69 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 14:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c2 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
+ {
+ /* _isTopLevelDictionary:False */
+ __that._component_2 = __p1;
+ __that.__2_Click_P3_Button_Click_Builder = (__owner) =>
{
- /* _isTopLevelDictionary:False */
- __that._component_2 = c2;
- __that.__2_Click_P3_Button_Click_Builder = (__owner) =>
+ var Click_P3_Button_Click_That = (__that as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
+ /* first level targetMethod:TestRepro.I.Button_Click(object, Microsoft.UI.Xaml.RoutedEventArgs) */ __owner.Click += (_sender,_e) =>
{
- var Click_P3_Button_Click_That = (__that as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
- /* first level targetMethod:TestRepro.I.Button_Click(object, Microsoft.UI.Xaml.RoutedEventArgs) */ __owner.Click += (_sender,_e) =>
- {
- (Click_P3_Button_Click_That.Target as global::TestRepro.MainPage)?.P3.Button_Click(_sender,_e);
- }
- ;
+ (Click_P3_Button_Click_That.Target as global::TestRepro.MainPage)?.P3.Button_Click(_sender,_e);
}
;
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ }
+ ;
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c3 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c4) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c4.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c5) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_3 = c5;
- // Class TestRepro.MainPage
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c5, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c5, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c5.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_3 = __p1;
+ // Class TestRepro.MainPage
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
private global::System.Action __0_Click_P1_Button_Click_Builder;
private global::System.Action __1_Click_P2_Button_Click_Builder;
private global::System.Action __2_Click_P3_Button_Click_Builder;
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Button _component_0
{
get
@@ -181,7 +181,7 @@ private void InitializeComponent()
_component_0_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Button _component_1
{
get
@@ -193,7 +193,7 @@ private void InitializeComponent()
_component_1_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Button _component_2
{
get
@@ -205,7 +205,7 @@ private void InitializeComponent()
_component_2_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_3_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_3_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Page _component_3
{
get
@@ -310,5 +310,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TMEWSFEL/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TMEWSFEL/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index cd548616f8c0..fc8d241d6fd8 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TMEWSFEL/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TMEWSFEL/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -50,35 +50,35 @@ private void InitializeComponent()
;
this
- .GenericApply(((c0) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c0.base does not exist on {using:TestRepro}BasePage, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {using:TestRepro}BasePage, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c1) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c1;
- // Class TestRepro.MainPage
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c1, global::TestRepro.BasePage.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ // Class TestRepro.MainPage
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::TestRepro.BasePage.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::TestRepro.BasePage _component_0
{
get
@@ -139,5 +139,12 @@ namespace MyProject
{
static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
{
+ public delegate void XamlApplyHandler0(global::TestRepro.BasePage instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::TestRepro.BasePage MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::TestRepro.BasePage instance, XamlApplyHandler0 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TMEWSWA/XamlCodeGenerator_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TMEWSWA/XamlCodeGenerator_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b.cs
index 49e4974989eb..8fccea5a61e6 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TMEWSWA/XamlCodeGenerator_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TMEWSWA/XamlCodeGenerator_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b.cs
@@ -51,28 +51,28 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainWindow.xaml (Line 10:3)
}
- .MainWindow_c93db19a7202d9eb84ddc41d72fcb89b_XamlApply((MainWindow_c93db19a7202d9eb84ddc41d72fcb89bXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainWindow_c93db19a7202d9eb84ddc41d72fcb89b_XamlApply((MainWindow_c93db19a7202d9eb84ddc41d72fcb89bXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c0, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c1) =>
+ .MainWindow_c93db19a7202d9eb84ddc41d72fcb89b_XamlApply((MainWindow_c93db19a7202d9eb84ddc41d72fcb89bXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Source 0\MainWindow.xaml (Line 1:2)
-
- // WARNING Property c1.base does not exist on {using:TestRepro}BaseWindow, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainWindow.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {using:TestRepro}BaseWindow, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c2) =>
+ .MainWindow_c93db19a7202d9eb84ddc41d72fcb89b_XamlApply((MainWindow_c93db19a7202d9eb84ddc41d72fcb89bXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Class TestRepro.MainWindow
+ // Class TestRepro.MainWindow
}
))
;
@@ -83,14 +83,14 @@ private void InitializeComponent()
OnInitializeCompleted();
Bindings = new MainWindow_Bindings(this);
- ((global::Microsoft.UI.Xaml.Window)this).Activated += (s, e) =>
- {
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.Window)this).Activated += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(object s, global::Microsoft.UI.Xaml.WindowActivatedEventArgs e)
+ {
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Page _component_0
{
get
@@ -158,5 +158,12 @@ static class MainWindow_c93db19a7202d9eb84ddc41d72fcb89bXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler1(global::TestRepro.BaseWindow instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::TestRepro.BaseWindow MainWindow_c93db19a7202d9eb84ddc41d72fcb89b_XamlApply(this global::TestRepro.BaseWindow instance, XamlApplyHandler1 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TNMEIAP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TNMEIAP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index a00781b14041..08c34cfcd5cc 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TNMEIAP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TNMEIAP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -59,38 +59,38 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 11:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Microsoft.UI.Xaml.Controls.ToolTipService.SetToolTip(c0,
- null );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ global::Microsoft.UI.Xaml.Controls.ToolTipService.SetToolTip(__p1,
+ null );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
@@ -118,5 +118,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TNMEIRP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TNMEIRP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 507c3e1ad5fd..95328b66c38d 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TNMEIRP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TNMEIRP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -60,36 +60,36 @@ private void InitializeComponent()
Text = null ,
// Source 0\MainPage.xaml (Line 11:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
@@ -117,5 +117,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TPXBRXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TPXBRXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index f4b6dfb0cfd1..16dec2879e8c 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TPXBRXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TPXBRXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -71,60 +71,59 @@ private void InitializeComponent()
Content = "Loaded via x:Load and toggle enable for buttons"
,
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- __nameScope.RegisterName("LoadElement", c0);
- __that.LoadElement = c0;
- // FieldModifier public
- /* Skipping x:Load attribute already applied to ElementStub */
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __nameScope.RegisterName("LoadElement", __p1);
+ __that.LoadElement = __p1;
+ // FieldModifier public
+ /* Skipping x:Load attribute already applied to ElementStub */
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
- ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- c1.Name = "LoadElement";
- _LoadElementSubject.ElementInstance = c1;
- c1.SetBinding(
- global::Microsoft.UI.Xaml.ElementStub.LoadProperty,
- new Microsoft.UI.Xaml.Data.Binding()
+ __p1.Name = "LoadElement";
+ _LoadElementSubject.ElementInstance = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.ElementStub.LoadProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
+ Converter = (global::Microsoft.UI.Xaml.Data.IValueConverter)global::Uno.UI.ResourceResolverSingleton.Instance.ResolveResourceStatic("NullableBoolConverter", typeof(global::Microsoft.UI.Xaml.Data.IValueConverter), context: global::MyProject.GlobalStaticResources.__ParseContext_),
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ToggleLoad.IsChecked*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ToggleLoad.IsChecked)) : (false, default), null , new [] {"ToggleLoad.IsChecked"}))
+ );
+ __that._component_1 = __p1;
+ var _component_1_update_That = (this as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
+ void _component_1_update(global::Microsoft.UI.Xaml.ElementStub sender)
+ {
+ if (_component_1_update_That.Target is global::TestRepro.MainPage that)
+ {
+ if (sender.IsMaterialized)
{
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
- Converter = (global::Microsoft.UI.Xaml.Data.IValueConverter)global::Uno.UI.ResourceResolverSingleton.Instance.ResolveResourceStatic("NullableBoolConverter", typeof(global::Microsoft.UI.Xaml.Data.IValueConverter), context: global::MyProject.GlobalStaticResources.__ParseContext_),
+ that.Bindings.UpdateResources();
+ that.Bindings.NotifyXLoad("LoadElement");
}
- .BindingApply(___b => /*defaultBindModeOneTime ToggleLoad.IsChecked*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ToggleLoad.IsChecked)) : (false, default), null , new [] {"ToggleLoad.IsChecked"}))
- );
- __that._component_1 = c1;
- var _component_1_update_That = (this as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
- var _component_1_update_subject_capture = _LoadElementSubject;
- void _component_1_update(global::Microsoft.UI.Xaml.ElementStub sender)
- {
- if (_component_1_update_That.Target is global::TestRepro.MainPage that)
+ else
{
- if (sender.IsMaterialized)
- {
- that.Bindings.UpdateResources();
- that.Bindings.NotifyXLoad("LoadElement");
- }
- else
- {
- _LoadElementSubject.ElementInstance = null;
- }
+ that._LoadElementSubject.ElementInstance = null;
}
}
- c1.MaterializationChanged += _component_1_update;
- var owner = this;
- void _component_1_materializing(object sender)
+ }
+ __p1.MaterializationChanged += _component_1_update;
+ var owner = this;
+ void _component_1_materializing(object sender)
+ {
+ if (_component_1_update_That.Target is global::TestRepro.MainPage that)
{
- if (_component_1_update_That.Target is global::TestRepro.MainPage that)
- {
- that._component_0.ApplyXBind();
- that._component_0.UpdateResourceBindings();
- }
+ that._component_0.ApplyXBind();
+ that._component_0.UpdateResourceBindings();
}
- c1.Materializing += _component_1_materializing;
+ }
+ __p1.Materializing += _component_1_materializing;
}
))
,
@@ -136,23 +135,23 @@ void _component_1_materializing(object sender)
Content = "Button1"
,
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(c2 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_2 = c2;
- __nameScope.RegisterName("button1", c2);
- __that.button1 = c2;
- // FieldModifier public
- c2.SetBinding(
- global::Microsoft.UI.Xaml.Controls.Button.TagProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = BindingMode.OneTime,
- }
- .BindingApply(___b => /*defaultBindModeOneTime */ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___ctx)) : (false, default), null ))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_2 = __p1;
+ __nameScope.RegisterName("button1", __p1);
+ __that.button1 = __p1;
+ // FieldModifier public
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.Button.TagProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = BindingMode.OneTime,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime */ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___ctx)) : (false, default), null ))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -165,53 +164,53 @@ void _component_1_materializing(object sender)
Content = "Toggle Load"
,
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c3 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- __nameScope.RegisterName("ToggleLoad", c3);
- __that.ToggleLoad = c3;
- // FieldModifier public
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ __nameScope.RegisterName("ToggleLoad", __p1);
+ __that.ToggleLoad = __p1;
+ // FieldModifier public
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(c4 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c4, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c4.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c5) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler4)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c5.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c6) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler4)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c6, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c6.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
private global::Microsoft.UI.Xaml.Data.ElementNameSubject _LoadElementSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
public global::Microsoft.UI.Xaml.Controls.Primitives.ToggleButton LoadElement
{
@@ -248,7 +247,7 @@ void _component_1_materializing(object sender)
_ToggleLoadSubject.ElementInstance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Primitives.ToggleButton _component_0
{
get
@@ -260,7 +259,7 @@ void _component_1_materializing(object sender)
_component_0_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: false);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: false);
private global::Microsoft.UI.Xaml.ElementStub _component_1
{
get
@@ -272,7 +271,7 @@ void _component_1_materializing(object sender)
_component_1_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Button _component_2
{
get
@@ -369,5 +368,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler4(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler4 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TRDAAPSSTP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TRDAAPSSTP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index b353a45113b8..fa18888180f4 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TRDAAPSSTP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TRDAAPSSTP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -60,72 +60,72 @@ private void InitializeComponent()
Content = @"Button",
// Source 0\MainPage.xaml (Line 12:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::TestRepro.MyClass.SetX(c0,
- new global::Microsoft.UI.Xaml.ResourceDictionary
- {
- IsParsing = true,
- [
- "PrimaryColor"
- ] =
- global::Microsoft.UI.Colors.Yellow ,
- [
- "SecondaryColor"
- ] =
- global::Microsoft.UI.Colors.Red ,
- }
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
- {
- c1.CreationComplete();
- }
- ))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ global::TestRepro.MyClass.SetX(__p1,
+ new global::Microsoft.UI.Xaml.ResourceDictionary
+ {
+ IsParsing = true,
+ [
+ "PrimaryColor"
+ ] =
+ global::Microsoft.UI.Colors.Yellow ,
+ [
+ "SecondaryColor"
+ ] =
+ global::Microsoft.UI.Colors.Red ,
+ }
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
+ {
+ __p1.CreationComplete();
+ }
+ ))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(c2 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c3.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c4) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c4;
- // Class TestRepro.MainPage
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c4, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c4, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c4.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ // Class TestRepro.MainPage
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Page _component_0
{
get
@@ -207,5 +207,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler3(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler3 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTIXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTIXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 30fc51a7a721..d4ebf2833915 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTIXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTIXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -75,23 +75,23 @@ private void InitializeComponent()
Name = "inner1Button",
// Source 0\MainPage.xaml (Line 13:6)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- __nameScope.RegisterName("inner1Button", c0);
- __that.inner1Button = c0;
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ __nameScope.RegisterName("inner1Button", __p1);
+ __that.inner1Button = __p1;
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- __nameScope.RegisterName("inner1", c1);
- __that.inner1 = c1;
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ __nameScope.RegisterName("inner1", __p1);
+ __that.inner1 = __p1;
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -103,12 +103,12 @@ private void InitializeComponent()
) ,
// Source 0\MainPage.xaml (Line 15:5)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c2 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- __nameScope.RegisterName("inner2", c2);
- __that.inner2 = c2;
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ __nameScope.RegisterName("inner2", __p1);
+ __that.inner2 = __p1;
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -125,130 +125,129 @@ private void InitializeComponent()
Name = "inner3Button",
// Source 0\MainPage.xaml (Line 25:6)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c3 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- __nameScope.RegisterName("inner3Button", c3);
- __that.inner3Button = c3;
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ __nameScope.RegisterName("inner3Button", __p1);
+ __that.inner3Button = __p1;
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c4 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- __nameScope.RegisterName("inner3", c4);
- __that.inner3 = c4;
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c4, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c4.CreationComplete();
+ __nameScope.RegisterName("inner3", __p1);
+ __that.inner3 = __p1;
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(c5 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c5;
- __nameScope.RegisterName("outerGrid", c5);
- __that.outerGrid = c5;
- /* Skipping x:Load attribute already applied to ElementStub */
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c5, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c5.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __nameScope.RegisterName("outerGrid", __p1);
+ __that.outerGrid = __p1;
+ /* Skipping x:Load attribute already applied to ElementStub */
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
- ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(c6 =>
+ ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- c6.Name = "outerGrid";
- _outerGridSubject.ElementInstance = c6;
- c6.SetBinding(
- global::Microsoft.UI.Xaml.ElementStub.LoadProperty,
- new Microsoft.UI.Xaml.Data.Binding()
+ __p1.Name = "outerGrid";
+ _outerGridSubject.ElementInstance = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.ElementStub.LoadProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = BindingMode.OneTime,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime IsLoaded*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? (TryGetInstance_xBind_1(___tctx, out var bindResult1) ? (true, bindResult1) : (false, default)) : (false, default), null ))
+ );
+ __that._component_1 = __p1;
+ var _component_1_update_That = (this as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
+ void _component_1_update(global::Microsoft.UI.Xaml.ElementStub sender)
+ {
+ if (_component_1_update_That.Target is global::TestRepro.MainPage that)
+ {
+ if (sender.IsMaterialized)
{
- Mode = BindingMode.OneTime,
+ that.Bindings.UpdateResources();
+ that.Bindings.NotifyXLoad("outerGrid");
}
- .BindingApply(___b => /*defaultBindModeOneTime IsLoaded*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? (TryGetInstance_xBind_1(___tctx, out var bindResult1) ? (true, bindResult1) : (false, default)) : (false, default), null ))
- );
- __that._component_1 = c6;
- var _component_1_update_That = (this as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
- var _component_1_update_subject_capture = _outerGridSubject;
- void _component_1_update(global::Microsoft.UI.Xaml.ElementStub sender)
- {
- if (_component_1_update_That.Target is global::TestRepro.MainPage that)
+ else
{
- if (sender.IsMaterialized)
- {
- that.Bindings.UpdateResources();
- that.Bindings.NotifyXLoad("outerGrid");
- }
- else
- {
- _outerGridSubject.ElementInstance = null;
- _inner1Subject.ElementInstance = null;
- _inner1Subject.ElementInstance = null;
- _inner1ButtonSubject.ElementInstance = null;
- _inner1ButtonSubject.ElementInstance = null;
- _inner2Subject.ElementInstance = null;
- _inner2Subject.ElementInstance = null;
- _inner3Subject.ElementInstance = null;
- _inner3Subject.ElementInstance = null;
- _inner3ButtonSubject.ElementInstance = null;
- _inner3ButtonSubject.ElementInstance = null;
- }
+ that._outerGridSubject.ElementInstance = null;
+ that._inner1Subject.ElementInstance = null;
+ that._inner1Subject.ElementInstance = null;
+ that._inner1ButtonSubject.ElementInstance = null;
+ that._inner1ButtonSubject.ElementInstance = null;
+ that._inner2Subject.ElementInstance = null;
+ that._inner2Subject.ElementInstance = null;
+ that._inner3Subject.ElementInstance = null;
+ that._inner3Subject.ElementInstance = null;
+ that._inner3ButtonSubject.ElementInstance = null;
+ that._inner3ButtonSubject.ElementInstance = null;
}
}
- c6.MaterializationChanged += _component_1_update;
- var owner = this;
- void _component_1_materializing(object sender)
+ }
+ __p1.MaterializationChanged += _component_1_update;
+ var owner = this;
+ void _component_1_materializing(object sender)
+ {
+ if (_component_1_update_That.Target is global::TestRepro.MainPage that)
{
- if (_component_1_update_That.Target is global::TestRepro.MainPage that)
- {
- that._component_0.ApplyXBind();
- that._component_0.UpdateResourceBindings();
- }
+ that._component_0.ApplyXBind();
+ that._component_0.UpdateResourceBindings();
}
- c6.Materializing += _component_1_materializing;
+ }
+ __p1.Materializing += _component_1_materializing;
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c7 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c7, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c7.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c8) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler4)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c8.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c9) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler4)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c9, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c9.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
private global::Microsoft.UI.Xaml.Data.ElementNameSubject _inner1ButtonSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
private global::Microsoft.UI.Xaml.Controls.Button inner1Button
{
@@ -324,18 +323,20 @@ void _component_1_materializing(object sender)
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
- private class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0
+ private class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
+ global::System.Object __ResourceOwner_1;
+ _View __rootInstance = null;
public _View Build(object __ResourceOwner_1)
{
- _View __rootInstance = null;
var __that = this;
- __rootInstance =
+ this.__ResourceOwner_1 = __ResourceOwner_1;
+ this.__rootInstance =
new global::Microsoft.UI.Xaml.Controls.Grid
{
IsParsing = true,
@@ -349,23 +350,23 @@ public _View Build(object __ResourceOwner_1)
Name = "gridInsideGridInsideTemplate",
// Source 0\MainPage.xaml (Line 19:9)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(c10 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- __nameScope.RegisterName("gridInsideGridInsideTemplate", c10);
- __that.gridInsideGridInsideTemplate = c10;
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c10, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c10.CreationComplete();
+ __nameScope.RegisterName("gridInsideGridInsideTemplate", __p1);
+ __that.gridInsideGridInsideTemplate = __p1;
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(c11 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- __nameScope.RegisterName("gridInsideTemplate", c11);
- __that.gridInsideTemplate = c11;
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c11, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c11.CreationComplete();
+ __nameScope.RegisterName("gridInsideTemplate", __p1);
+ __that.gridInsideTemplate = __p1;
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
@@ -405,7 +406,7 @@ public _View Build(object __ResourceOwner_1)
}
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Grid _component_0
{
get
@@ -417,7 +418,7 @@ public _View Build(object __ResourceOwner_1)
_component_0_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: false);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: false);
private global::Microsoft.UI.Xaml.ElementStub _component_1
{
get
@@ -518,5 +519,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler4(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler4 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTPWXS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTPWXS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index e68fe6e80e21..d5cd44c387ab 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTPWXS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTPWXS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -54,27 +54,27 @@ private void InitializeComponent()
MyProperty = typeof(string),
// Source 0\MainPage.xaml (Line 9:3)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c1) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
@@ -95,5 +95,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler1(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler1 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTW/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTW/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 3e52c509e1d7..4ef8ea923aaa 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTW/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TTW/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -59,64 +59,64 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 12:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.P*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? (TryGetInstance_xBind_1(___tctx, out var bindResult1) ? (true, bindResult1) : (false, default)) : (false, default), (___ctx, __value) => { if(___ctx is global::TestRepro.MainPage ___tctx) TrySetInstance_xBind_1(___tctx, __value); } , new [] {"ViewModel.P"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.P*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? (TryGetInstance_xBind_1(___tctx, out var bindResult1) ? (true, bindResult1) : (false, default)) : (false, default), (___ctx, __value) => { if(___ctx is global::TestRepro.MainPage ___tctx) TrySetInstance_xBind_1(___tctx, __value); } , new [] {"ViewModel.P"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_1 = c3;
- // Class TestRepro.MainPage
- global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(c3, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_1 = __p1;
+ // Class TestRepro.MainPage
+ global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: false, context: global::MyProject.GlobalStaticResources.__ParseContext_);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -128,7 +128,7 @@ private void InitializeComponent()
_component_0_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Page _component_1
{
get
@@ -220,5 +220,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TVBP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TVBP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index ea6db7c4cd4f..27e5bf405ecf 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TVBP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TVBP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -62,37 +62,37 @@ private void InitializeComponent()
FontSize = 30d,
// Source 0\MainPage.xaml (Line 9:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.Toolkit.VisibleBoundsPadding.SetPaddingMask(c1, global::Uno.UI.Toolkit.VisibleBoundsPadding.PaddingMask.Top);
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ global::Uno.UI.Toolkit.VisibleBoundsPadding.SetPaddingMask(__p1, global::Uno.UI.Toolkit.VisibleBoundsPadding.PaddingMask.Top);
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
@@ -120,5 +120,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TXBRXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TXBRXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 412d8268678c..04a78ae5a2a3 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TXBRXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/TXBRXLE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -71,60 +71,59 @@ private void InitializeComponent()
Content = "Loaded via x:Load and toggle enable for buttons"
,
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- __nameScope.RegisterName("LoadElement", c0);
- __that.LoadElement = c0;
- // FieldModifier public
- /* Skipping x:Load attribute already applied to ElementStub */
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __nameScope.RegisterName("LoadElement", __p1);
+ __that.LoadElement = __p1;
+ // FieldModifier public
+ /* Skipping x:Load attribute already applied to ElementStub */
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
- ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- c1.Name = "LoadElement";
- _LoadElementSubject.ElementInstance = c1;
- c1.SetBinding(
- global::Microsoft.UI.Xaml.ElementStub.LoadProperty,
- new Microsoft.UI.Xaml.Data.Binding()
+ __p1.Name = "LoadElement";
+ _LoadElementSubject.ElementInstance = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.ElementStub.LoadProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
+ Converter = (global::Microsoft.UI.Xaml.Data.IValueConverter)global::Uno.UI.ResourceResolverSingleton.Instance.ResolveResourceStatic("NullableBoolConverter", typeof(global::Microsoft.UI.Xaml.Data.IValueConverter), context: global::MyProject.GlobalStaticResources.__ParseContext_),
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ToggleLoad.IsChecked*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ToggleLoad.IsChecked)) : (false, default), null , new [] {"ToggleLoad.IsChecked"}))
+ );
+ __that._component_1 = __p1;
+ var _component_1_update_That = (this as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
+ void _component_1_update(global::Microsoft.UI.Xaml.ElementStub sender)
+ {
+ if (_component_1_update_That.Target is global::TestRepro.MainPage that)
+ {
+ if (sender.IsMaterialized)
{
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
- Converter = (global::Microsoft.UI.Xaml.Data.IValueConverter)global::Uno.UI.ResourceResolverSingleton.Instance.ResolveResourceStatic("NullableBoolConverter", typeof(global::Microsoft.UI.Xaml.Data.IValueConverter), context: global::MyProject.GlobalStaticResources.__ParseContext_),
+ that.Bindings.UpdateResources();
+ that.Bindings.NotifyXLoad("LoadElement");
}
- .BindingApply(___b => /*defaultBindModeOneTime ToggleLoad.IsChecked*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ToggleLoad.IsChecked)) : (false, default), null , new [] {"ToggleLoad.IsChecked"}))
- );
- __that._component_1 = c1;
- var _component_1_update_That = (this as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
- var _component_1_update_subject_capture = _LoadElementSubject;
- void _component_1_update(global::Microsoft.UI.Xaml.ElementStub sender)
- {
- if (_component_1_update_That.Target is global::TestRepro.MainPage that)
+ else
{
- if (sender.IsMaterialized)
- {
- that.Bindings.UpdateResources();
- that.Bindings.NotifyXLoad("LoadElement");
- }
- else
- {
- _LoadElementSubject.ElementInstance = null;
- }
+ that._LoadElementSubject.ElementInstance = null;
}
}
- c1.MaterializationChanged += _component_1_update;
- var owner = this;
- void _component_1_materializing(object sender)
+ }
+ __p1.MaterializationChanged += _component_1_update;
+ var owner = this;
+ void _component_1_materializing(object sender)
+ {
+ if (_component_1_update_That.Target is global::TestRepro.MainPage that)
{
- if (_component_1_update_That.Target is global::TestRepro.MainPage that)
- {
- that._component_0.ApplyXBind();
- that._component_0.UpdateResourceBindings();
- }
+ that._component_0.ApplyXBind();
+ that._component_0.UpdateResourceBindings();
}
- c1.Materializing += _component_1_materializing;
+ }
+ __p1.Materializing += _component_1_materializing;
}
))
,
@@ -136,24 +135,24 @@ void _component_1_materializing(object sender)
Content = "Button1"
,
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(c2 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_2 = c2;
- __nameScope.RegisterName("button1", c2);
- __that.button1 = c2;
- // FieldModifier public
- c2.SetBinding(
- global::Microsoft.UI.Xaml.Controls.Button.IsEnabledProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
- Converter = (global::Microsoft.UI.Xaml.Data.IValueConverter)global::Uno.UI.ResourceResolverSingleton.Instance.ResolveResourceStatic("NullableBoolConverter", typeof(global::Microsoft.UI.Xaml.Data.IValueConverter), context: global::MyProject.GlobalStaticResources.__ParseContext_),
- }
- .BindingApply(___b => /*defaultBindModeOneTime LoadElement.IsChecked*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.LoadElement.IsChecked)) : (false, default), null , new [] {"LoadElement.IsChecked"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_2 = __p1;
+ __nameScope.RegisterName("button1", __p1);
+ __that.button1 = __p1;
+ // FieldModifier public
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.Button.IsEnabledProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
+ Converter = (global::Microsoft.UI.Xaml.Data.IValueConverter)global::Uno.UI.ResourceResolverSingleton.Instance.ResolveResourceStatic("NullableBoolConverter", typeof(global::Microsoft.UI.Xaml.Data.IValueConverter), context: global::MyProject.GlobalStaticResources.__ParseContext_),
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime LoadElement.IsChecked*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.LoadElement.IsChecked)) : (false, default), null , new [] {"LoadElement.IsChecked"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -166,53 +165,53 @@ void _component_1_materializing(object sender)
Content = "Toggle Load"
,
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c3 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- __nameScope.RegisterName("ToggleLoad", c3);
- __that.ToggleLoad = c3;
- // FieldModifier public
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ __nameScope.RegisterName("ToggleLoad", __p1);
+ __that.ToggleLoad = __p1;
+ // FieldModifier public
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(c4 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c4, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c4.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c5) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler4)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c5.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c6) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler4)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c6, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c6.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
private global::Microsoft.UI.Xaml.Data.ElementNameSubject _LoadElementSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
public global::Microsoft.UI.Xaml.Controls.Primitives.ToggleButton LoadElement
{
@@ -249,7 +248,7 @@ void _component_1_materializing(object sender)
_ToggleLoadSubject.ElementInstance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Primitives.ToggleButton _component_0
{
get
@@ -261,7 +260,7 @@ void _component_1_materializing(object sender)
_component_0_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: false);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: false);
private global::Microsoft.UI.Xaml.ElementStub _component_1
{
get
@@ -273,7 +272,7 @@ void _component_1_materializing(object sender)
_component_1_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.Button _component_2
{
get
@@ -371,5 +370,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler4(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler4 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WADPIT/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WADPIT/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index ae8d957600b2..4e8fb70a7154 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WADPIT/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WADPIT/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -53,33 +53,33 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 7:3)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::TestRepro.MyAttached.SetMyProperty(c0,
- new global::TestRepro.TestDisposable
- {
- // Source 0\MainPage.xaml (Line 9:5)
- }
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ global::TestRepro.MyAttached.SetMyProperty(__p1,
+ new global::TestRepro.TestDisposable
+ {
+ // Source 0\MainPage.xaml (Line 9:5)
+ }
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c1) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
@@ -100,5 +100,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler1(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler1 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WBENIT/XamlCodeGenerator_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WBENIT/XamlCodeGenerator_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca.cs
index 4bffbbccc19e..0252c59a7451 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WBENIT/XamlCodeGenerator_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WBENIT/XamlCodeGenerator_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca.cs
@@ -63,39 +63,39 @@ private void InitializeComponent()
) ,
// Source 0\Binding_ElementName_In_Template.xaml (Line 11:4)
}
- .Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_XamlApply((Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237ecaXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_XamlApply((Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237ecaXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- __nameScope.RegisterName("topLevel", c0);
- __that.topLevel = c0;
- // FieldModifier public
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca);
- c0.CreationComplete();
+ __nameScope.RegisterName("topLevel", __p1);
+ __that.topLevel = __p1;
+ // FieldModifier public
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca);
+ __p1.CreationComplete();
}
))
,
}
}
- .Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_XamlApply((Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237ecaXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_XamlApply((Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237ecaXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_XamlApply((Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237ecaXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\Binding_ElementName_In_Template.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\Binding_ElementName_In_Template.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_XamlApply((Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237ecaXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class Uno.UI.Tests.Windows_UI_Xaml_Data.BindingTests.Controls.Binding_ElementName_In_Template
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca);
- c3.CreationComplete();
+ // Class Uno.UI.Tests.Windows_UI_Xaml_Data.BindingTests.Controls.Binding_ElementName_In_Template
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca);
+ __p1.CreationComplete();
}
))
;
@@ -118,51 +118,48 @@ private void InitializeComponent()
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
- private class _Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_UnoUITestsWindows_UI_Xaml_DataBindingTestsControlsBinding_ElementName_In_TemplateSC0
+ private class _Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_UnoUITestsWindows_UI_Xaml_DataBindingTestsControlsBinding_ElementName_In_TemplateSC0
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca = "ms-appx:///TestProject/";
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca = "ms-appx:///TestProject/";
global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();
+ global::System.Object __ResourceOwner_1;
+ _View __rootInstance = null;
public _View Build(object __ResourceOwner_1)
{
- _View __rootInstance = null;
var __that = this;
- __rootInstance =
+ this.__ResourceOwner_1 = __ResourceOwner_1;
+ this.__rootInstance =
new global::Microsoft.UI.Xaml.Controls.TextBlock
{
IsParsing = true,
Name = "innerTextBlock",
// Source 0\Binding_ElementName_In_Template.xaml (Line 14:7)
}
- .Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_XamlApply((Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237ecaXamlApplyExtensions.XamlApplyHandler2)(c4 =>
+ .Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_XamlApply((Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237ecaXamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c4;
- __nameScope.RegisterName("innerTextBlock", c4);
- __that.innerTextBlock = c4;
- c4.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Path = @"Tag",
- ElementName = _topLevelSubject,
- }
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c4, __baseUri_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca);
- c4.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __nameScope.RegisterName("innerTextBlock", __p1);
+ __that.innerTextBlock = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Path = @"Tag",
+ ElementName = _topLevelSubject,
+ }
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca);
+ __p1.CreationComplete();
}
))
;
- if (__rootInstance is FrameworkElement __fe)
+ if (__rootInstance is FrameworkElement __fe)
{
- var owner = this;
- __fe.Loading += delegate
- {
- _component_0.UpdateResourceBindings();
- }
- ;
+ __fe.Loading += __UpdateBindingsAndResources;
}
if (__rootInstance is DependencyObject d)
{
@@ -175,7 +172,7 @@ public _View Build(object __ResourceOwner_1)
}
return __rootInstance;
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -200,6 +197,11 @@ public _View Build(object __ResourceOwner_1)
}
}
private global::Microsoft.UI.Xaml.Data.ElementNameSubject _topLevelSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject(isRuntimeBound: true, name: "topLevel");
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ var owner = this;
+ _component_0.UpdateResourceBindings();
+ }
}
}
}
@@ -221,9 +223,16 @@ static class Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237ecaXam
handler(instance);
return instance;
}
- public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.TextBlock instance);
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
+ public delegate void XamlApplyHandler3(global::Microsoft.UI.Xaml.Controls.TextBlock instance);
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
- public static global::Microsoft.UI.Xaml.Controls.TextBlock Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_XamlApply(this global::Microsoft.UI.Xaml.Controls.TextBlock instance, XamlApplyHandler2 handler)
+ public static global::Microsoft.UI.Xaml.Controls.TextBlock Binding_ElementName_In_Template_66bf0a54f1801c397a6fa4930a237eca_XamlApply(this global::Microsoft.UI.Xaml.Controls.TextBlock instance, XamlApplyHandler3 handler)
{
handler(instance);
return instance;
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WBOP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WBOP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index de8c4154b0cb..b4d2cb15eb3c 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WBOP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WBOP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -61,61 +61,61 @@ private void InitializeComponent()
OffContent = @"Disabled",
// Source 0\MainPage.xaml (Line 7:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.ToggleSwitch.IsOnProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.IsEnabled*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.IsEnabled)) : (false, default), (___ctx, __value) => { if(___ctx is global::TestRepro.MainPage ___tctx) ___tctx.ViewModel.IsEnabled = (bool)global::Microsoft.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(bool), __value); } , new [] {"ViewModel.IsEnabled"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.ToggleSwitch.IsOnProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.IsEnabled*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.IsEnabled)) : (false, default), (___ctx, __value) => { if(___ctx is global::TestRepro.MainPage ___tctx) ___tctx.ViewModel.IsEnabled = (bool)global::Microsoft.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(bool), __value); } , new [] {"ViewModel.IsEnabled"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.ToggleSwitch _component_0
{
get
@@ -191,5 +191,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 0013d351ffbf..4dbc989946c1 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -60,10 +60,10 @@ private void InitializeComponent()
Text = "Immediate content",
// Source 0\MainPage.xaml (Line 10:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -80,52 +80,52 @@ private void InitializeComponent()
Text = "Lazy Content",
// Source 0\MainPage.xaml (Line 12:5)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c2 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- __nameScope.RegisterName("LazyLoadedBorder", c2);
- __that.LazyLoadedBorder = c2;
- // DeferLoadStrategy Lazy
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ __nameScope.RegisterName("LazyLoadedBorder", __p1);
+ __that.LazyLoadedBorder = __p1;
+ // DeferLoadStrategy Lazy
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
- ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(c3 =>
+ ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- c3.Name = "LazyLoadedBorder";
- _LazyLoadedBorderSubject.ElementInstance = c3;
+ __p1.Name = "LazyLoadedBorder";
+ _LazyLoadedBorderSubject.ElementInstance = __p1;
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(c4 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c4, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c4.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c5) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler4)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c5.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c6) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler4)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c6, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c6.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
@@ -179,5 +179,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler4(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler4 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WEOTLNDO/XamlCodeGenerator_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WEOTLNDO/XamlCodeGenerator_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b.cs
index 3592ee6ffc62..8b732a87812e 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WEOTLNDO/XamlCodeGenerator_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WEOTLNDO/XamlCodeGenerator_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b.cs
@@ -48,18 +48,18 @@ private void InitializeComponent()
;
this
- .GenericApply(((c0) =>
+ .MainWindow_c93db19a7202d9eb84ddc41d72fcb89b_XamlApply((MainWindow_c93db19a7202d9eb84ddc41d72fcb89bXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- // Source 0\MainWindow.xaml (Line 1:2)
-
- // WARNING Property c0.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Window, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainWindow.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Window, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c1) =>
+ .MainWindow_c93db19a7202d9eb84ddc41d72fcb89b_XamlApply((MainWindow_c93db19a7202d9eb84ddc41d72fcb89bXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- // Class TestRepro.MainWindow
- var Closed_Window_Closed_That = (__that as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
- /* second level */ c1.Closed += (Window_Closed_sender,Window_Closed_args) => (Closed_Window_Closed_That.Target as global::TestRepro.MainWindow)?.Window_Closed(Window_Closed_sender,Window_Closed_args);
+ // Class TestRepro.MainWindow
+ var Closed_Window_Closed_That = (__that as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
+ /* second level */ __p1.Closed += (Window_Closed_sender,Window_Closed_args) => (Closed_Window_Closed_That.Target as global::TestRepro.MainWindow)?.Window_Closed(Window_Closed_sender,Window_Closed_args);
}
))
;
@@ -77,5 +77,12 @@ namespace MyProject
{
static class MainWindow_c93db19a7202d9eb84ddc41d72fcb89bXamlApplyExtensions
{
+ public delegate void XamlApplyHandler0(global::Microsoft.UI.Xaml.Window instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Window MainWindow_c93db19a7202d9eb84ddc41d72fcb89b_XamlApply(this global::Microsoft.UI.Xaml.Window instance, XamlApplyHandler0 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUBS/XamlCodeGenerator_Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUBS/XamlCodeGenerator_Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206.cs
index dbe76c567640..58f662b05fb6 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUBS/XamlCodeGenerator_Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUBS/XamlCodeGenerator_Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206.cs
@@ -180,30 +180,30 @@ private void InitializeComponent()
,
// Source 0\Grid_Uses_Both_Syntaxes.xaml (Line 11:6)
}
- .Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206_XamlApply((Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206XamlApplyExtensions.XamlApplyHandler2)(c10 =>
+ .Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206_XamlApply((Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206XamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- __nameScope.RegisterName("grid", c10);
- __that.grid = c10;
- // FieldModifier public
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c10, __baseUri_Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206);
- c10.CreationComplete();
+ __nameScope.RegisterName("grid", __p1);
+ __that.grid = __p1;
+ // FieldModifier public
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c11) =>
+ .Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206_XamlApply((Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206XamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- // Source 0\Grid_Uses_Both_Syntaxes.xaml (Line 1:2)
-
- // WARNING Property c11.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\Grid_Uses_Both_Syntaxes.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c12) =>
+ .Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206_XamlApply((Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206XamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- // Class Uno.UI.Tests.Windows_UI_XAML_Controls.GridTests.Controls.Grid_Uses_Both_Syntaxes
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c12, __baseUri_Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206);
- c12.CreationComplete();
+ // Class Uno.UI.Tests.Windows_UI_XAML_Controls.GridTests.Controls.Grid_Uses_Both_Syntaxes
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206);
+ __p1.CreationComplete();
}
))
;
@@ -250,5 +250,12 @@ static class Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206XamlApplyEx
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler3(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page Grid_Uses_Both_Syntaxes_794c1760299b374d12fe38ba3b633206_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler3 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUCS/XamlCodeGenerator_Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUCS/XamlCodeGenerator_Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7.cs
index 401376f031eb..78a1c94da9d6 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUCS/XamlCodeGenerator_Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUCS/XamlCodeGenerator_Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7.cs
@@ -122,30 +122,30 @@ private void InitializeComponent()
,
// Source 0\Grid_Uses_Common_Syntax.xaml (Line 10:6)
}
- .Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7_XamlApply((Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7XamlApplyExtensions.XamlApplyHandler2)(c10 =>
+ .Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7_XamlApply((Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7XamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- __nameScope.RegisterName("grid", c10);
- __that.grid = c10;
- // FieldModifier public
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c10, __baseUri_Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7);
- c10.CreationComplete();
+ __nameScope.RegisterName("grid", __p1);
+ __that.grid = __p1;
+ // FieldModifier public
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c11) =>
+ .Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7_XamlApply((Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7XamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- // Source 0\Grid_Uses_Common_Syntax.xaml (Line 1:2)
-
- // WARNING Property c11.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\Grid_Uses_Common_Syntax.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c12) =>
+ .Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7_XamlApply((Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7XamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- // Class Uno.UI.Tests.Windows_UI_XAML_Controls.GridTests.Controls.Grid_Uses_Common_Syntax
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c12, __baseUri_Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7);
- c12.CreationComplete();
+ // Class Uno.UI.Tests.Windows_UI_XAML_Controls.GridTests.Controls.Grid_Uses_Common_Syntax
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7);
+ __p1.CreationComplete();
}
))
;
@@ -192,5 +192,12 @@ static class Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7XamlApplyEx
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler3(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page Grid_Uses_Common_Syntax_8659265dc2cabf0b5a684f0f4b26f8b7_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler3 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUNACPS/XamlCodeGenerator_Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUNACPS/XamlCodeGenerator_Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef.cs
index 754bf1215ac5..c990dccf92a9 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUNACPS/XamlCodeGenerator_Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUNACPS/XamlCodeGenerator_Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef.cs
@@ -122,30 +122,30 @@ private void InitializeComponent()
,
// Source 0\Grid_Uses_New_Assigned_ContentProperty_Syntax.xaml (Line 10:6)
}
- .Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef_XamlApply((Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509efXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef_XamlApply((Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509efXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- __nameScope.RegisterName("grid", c0);
- __that.grid = c0;
- // FieldModifier public
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef);
- c0.CreationComplete();
+ __nameScope.RegisterName("grid", __p1);
+ __that.grid = __p1;
+ // FieldModifier public
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c1) =>
+ .Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef_XamlApply((Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509efXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Source 0\Grid_Uses_New_Assigned_ContentProperty_Syntax.xaml (Line 1:2)
-
- // WARNING Property c1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\Grid_Uses_New_Assigned_ContentProperty_Syntax.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c2) =>
+ .Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef_XamlApply((Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509efXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Class Uno.UI.Tests.Windows_UI_XAML_Controls.GridTests.Controls.Grid_Uses_New_Assigned_ContentProperty_Syntax
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef);
- c2.CreationComplete();
+ // Class Uno.UI.Tests.Windows_UI_XAML_Controls.GridTests.Controls.Grid_Uses_New_Assigned_ContentProperty_Syntax
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef);
+ __p1.CreationComplete();
}
))
;
@@ -178,5 +178,12 @@ static class Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler1(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page Grid_Uses_New_Assigned_ContentProperty_Syntax_9f853e56098ff21d39f15479035509ef_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler1 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUNSS/XamlCodeGenerator_Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUNSS/XamlCodeGenerator_Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609.cs
index 3838abc3ae60..9e1f23b0b29a 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUNSS/XamlCodeGenerator_Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WGUNSS/XamlCodeGenerator_Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609.cs
@@ -112,30 +112,30 @@ private void InitializeComponent()
,
// Source 0\Grid_Uses_New_Succinct_Syntax.xaml (Line 10:6)
}
- .Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609_XamlApply((Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609XamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609_XamlApply((Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609XamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- __nameScope.RegisterName("grid", c0);
- __that.grid = c0;
- // FieldModifier public
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609);
- c0.CreationComplete();
+ __nameScope.RegisterName("grid", __p1);
+ __that.grid = __p1;
+ // FieldModifier public
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c1) =>
+ .Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609_XamlApply((Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609XamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Source 0\Grid_Uses_New_Succinct_Syntax.xaml (Line 1:2)
-
- // WARNING Property c1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\Grid_Uses_New_Succinct_Syntax.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c2) =>
+ .Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609_XamlApply((Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609XamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Class Uno.UI.Tests.Windows_UI_XAML_Controls.GridTests.Controls.Grid_Uses_New_Succinct_Syntax
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609);
- c2.CreationComplete();
+ // Class Uno.UI.Tests.Windows_UI_XAML_Controls.GridTests.Controls.Grid_Uses_New_Succinct_Syntax
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609);
+ __p1.CreationComplete();
}
))
;
@@ -168,5 +168,12 @@ static class Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609XamlA
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler1(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page Grid_Uses_New_Succinct_Syntax_cc38332c9fd4c0da9c1fa0270bbd3609_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler1 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WI/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WI/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 1e27d3994324..ee2f09e82b16 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WI/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WI/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -61,36 +61,36 @@ private void InitializeComponent()
MyProperty = double.PositiveInfinity,
// Source 0\MainPage.xaml (Line 8:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
@@ -111,5 +111,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler1(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler1 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index d62b73cfb196..56f440117fa9 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -61,103 +61,102 @@ private void InitializeComponent()
Name = "innerTextBlock",
// Source 0\MainPage.xaml (Line 10:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- __nameScope.RegisterName("innerTextBlock", c0);
- __that.innerTextBlock = c0;
- // FieldModifier public
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime InnerText*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? (TryGetInstance_xBind_1(___tctx, out var bindResult1) ? (true, bindResult1) : (false, default)) : (false, default), null , new [] {"InnerText"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __nameScope.RegisterName("innerTextBlock", __p1);
+ __that.innerTextBlock = __p1;
+ // FieldModifier public
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime InnerText*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? (TryGetInstance_xBind_1(___tctx, out var bindResult1) ? (true, bindResult1) : (false, default)) : (false, default), null , new [] {"InnerText"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- __nameScope.RegisterName("topLevelContent", c1);
- __that.topLevelContent = c1;
- // FieldModifier public
- // Load false
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ __nameScope.RegisterName("topLevelContent", __p1);
+ __that.topLevelContent = __p1;
+ // FieldModifier public
+ // Load false
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
- ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(c2 =>
+ ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
+ {
+ __p1.Name = "topLevelContent";
+ _topLevelContentSubject.ElementInstance = __p1;
+ __that._component_1 = __p1;
+ var _component_1_update_That = (this as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
+ void _component_1_update(global::Microsoft.UI.Xaml.ElementStub sender)
{
- c2.Name = "topLevelContent";
- _topLevelContentSubject.ElementInstance = c2;
- __that._component_1 = c2;
- var _component_1_update_That = (this as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;
- var _component_1_update_subject_capture = _topLevelContentSubject;
- void _component_1_update(global::Microsoft.UI.Xaml.ElementStub sender)
+ if (_component_1_update_That.Target is global::TestRepro.MainPage that)
{
- if (_component_1_update_That.Target is global::TestRepro.MainPage that)
+ if (sender.IsMaterialized)
{
- if (sender.IsMaterialized)
- {
- that.Bindings.UpdateResources();
- that.Bindings.NotifyXLoad("topLevelContent");
- }
- else
- {
- _topLevelContentSubject.ElementInstance = null;
- _innerTextBlockSubject.ElementInstance = null;
- _innerTextBlockSubject.ElementInstance = null;
- }
+ that.Bindings.UpdateResources();
+ that.Bindings.NotifyXLoad("topLevelContent");
}
- }
- c2.MaterializationChanged += _component_1_update;
- var owner = this;
- void _component_1_materializing(object sender)
- {
- if (_component_1_update_That.Target is global::TestRepro.MainPage that)
+ else
{
- that._component_0.ApplyXBind();
- that._component_0.UpdateResourceBindings();
+ that._topLevelContentSubject.ElementInstance = null;
+ that._innerTextBlockSubject.ElementInstance = null;
+ that._innerTextBlockSubject.ElementInstance = null;
}
}
- c2.Materializing += _component_1_materializing;
+ }
+ __p1.MaterializationChanged += _component_1_update;
+ var owner = this;
+ void _component_1_materializing(object sender)
+ {
+ if (_component_1_update_That.Target is global::TestRepro.MainPage that)
+ {
+ that._component_0.ApplyXBind();
+ that._component_0.UpdateResourceBindings();
+ }
+ }
+ __p1.Materializing += _component_1_materializing;
}
))
;
this
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c3.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c4) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c4, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c4.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
private global::Microsoft.UI.Xaml.Data.ElementNameSubject _innerTextBlockSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
public global::Microsoft.UI.Xaml.Controls.TextBlock innerTextBlock
{
@@ -182,7 +181,7 @@ void _component_1_materializing(object sender)
_topLevelContentSubject.ElementInstance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -194,7 +193,7 @@ void _component_1_materializing(object sender)
_component_0_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: false);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: false);
private global::Microsoft.UI.Xaml.ElementStub _component_1
{
get
@@ -284,5 +283,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler3(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler3 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNBOP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNBOP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 771a3047b3e3..2d33b95efc60 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNBOP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNBOP/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -61,61 +61,61 @@ private void InitializeComponent()
OffContent = @"Disabled",
// Source 0\MainPage.xaml (Line 7:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.ToggleSwitch.IsOnProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.SubModel.IsEnabled*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.SubModel.IsEnabled)) : (false, default), (___ctx, __value) => { if(___ctx is global::TestRepro.MainPage ___tctx) ___tctx.ViewModel.SubModel.IsEnabled = (bool)global::Microsoft.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(bool), __value); } , new [] {"ViewModel.SubModel.IsEnabled"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.ToggleSwitch.IsOnProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.SubModel.IsEnabled*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.SubModel.IsEnabled)) : (false, default), (___ctx, __value) => { if(___ctx is global::TestRepro.MainPage ___tctx) ___tctx.ViewModel.SubModel.IsEnabled = (bool)global::Microsoft.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(bool), __value); } , new [] {"ViewModel.SubModel.IsEnabled"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.ToggleSwitch _component_0
{
get
@@ -191,5 +191,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNIONE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNIONE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 5123a84c3951..0dfd917a3b34 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNIONE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNIONE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -60,36 +60,36 @@ private void InitializeComponent()
Source = typeof(global::NamespaceUnderTest.C),
// Source 0\MainPage.xaml (Line 9:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
@@ -117,5 +117,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index c3a0c529f28f..142a79638ad3 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WNS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -50,51 +50,55 @@ private void InitializeComponent()
"MyStyle"
] =
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
- new global::Microsoft.UI.Xaml.Style
- {
- TargetType = typeof(global::TestRepro.MyGrid),
- // Source 0\MainPage.xaml (Line 8:4)
- Setters =
+ {
+ return
+ new global::Microsoft.UI.Xaml.Style
{
- new global::Microsoft.UI.Xaml.Setter
+ TargetType = typeof(global::TestRepro.MyGrid),
+ // Source 0\MainPage.xaml (Line 8:4)
+ Setters =
{
- Property = global::TestRepro.MyGrid.FirstStyleProperty,
- Value = new global::Microsoft.UI.Xaml.Style
+ new global::Microsoft.UI.Xaml.Setter
{
- TargetType = typeof(global::Microsoft.UI.Xaml.Controls.Button),
- // Source 0\MainPage.xaml (Line 11:7)
+ Property = global::TestRepro.MyGrid.FirstStyleProperty,
+ Value = new global::Microsoft.UI.Xaml.Style
+ {
+ TargetType = typeof(global::Microsoft.UI.Xaml.Controls.Button),
+ // Source 0\MainPage.xaml (Line 11:7)
+ }
+ ,
+ // Source 0\MainPage.xaml (Line 9:5)
+ }
+ ,
+ new global::Microsoft.UI.Xaml.Setter
+ {
+ Property = global::TestRepro.MyGrid.SecondProperty,
+ Value = "Hello",
+ // Source 0\MainPage.xaml (Line 14:5)
}
,
- // Source 0\MainPage.xaml (Line 9:5)
- }
- ,
- new global::Microsoft.UI.Xaml.Setter
- {
- Property = global::TestRepro.MyGrid.SecondProperty,
- Value = "Hello",
- // Source 0\MainPage.xaml (Line 14:5)
}
- ,
}
- }
+ ;
+ }
)
;
// Source 0\MainPage.xaml (Line 1:2)
;
this
- .GenericApply(((c4) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c4.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c5) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c5, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c5.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
@@ -122,5 +126,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPADNE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPADNE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 7ff7fc66f88d..996b6e0904dd 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPADNE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPADNE/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -59,20 +59,20 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 7:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = BindingMode.OneTime,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null ))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = BindingMode.OneTime,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null ))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -81,20 +81,20 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 8:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_1 = c1;
- c1.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null , new [] {"ViewModel.Name"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_1 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null , new [] {"ViewModel.Name"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -103,61 +103,61 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 9:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c2 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_2 = c2;
- c2.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), (___tctx, __value) => ViewModel.MyBindBack((string)__value) , new [] {"ViewModel.Name"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_2 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), (___tctx, __value) => ViewModel.MyBindBack((string)__value) , new [] {"ViewModel.Name"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c3 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c4) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c4.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c5) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c5, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c5.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -169,7 +169,7 @@ private void InitializeComponent()
_component_0_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_1
{
get
@@ -181,7 +181,7 @@ private void InitializeComponent()
_component_1_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_2
{
get
@@ -261,5 +261,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE__name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE__name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 7ff7fc66f88d..996b6e0904dd 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE__name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE__name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -59,20 +59,20 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 7:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = BindingMode.OneTime,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null ))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = BindingMode.OneTime,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null ))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -81,20 +81,20 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 8:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_1 = c1;
- c1.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null , new [] {"ViewModel.Name"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_1 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null , new [] {"ViewModel.Name"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -103,61 +103,61 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 9:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c2 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_2 = c2;
- c2.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), (___tctx, __value) => ViewModel.MyBindBack((string)__value) , new [] {"ViewModel.Name"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_2 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), (___tctx, __value) => ViewModel.MyBindBack((string)__value) , new [] {"ViewModel.Name"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c3 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c4) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c4.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c5) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c5, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c5.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -169,7 +169,7 @@ private void InitializeComponent()
_component_0_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_1
{
get
@@ -181,7 +181,7 @@ private void InitializeComponent()
_component_1_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_2
{
get
@@ -261,5 +261,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE_m_name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE_m_name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 7ff7fc66f88d..996b6e0904dd 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE_m_name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE_m_name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -59,20 +59,20 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 7:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = BindingMode.OneTime,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null ))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = BindingMode.OneTime,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null ))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -81,20 +81,20 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 8:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_1 = c1;
- c1.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null , new [] {"ViewModel.Name"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_1 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null , new [] {"ViewModel.Name"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -103,61 +103,61 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 9:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c2 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_2 = c2;
- c2.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), (___tctx, __value) => ViewModel.MyBindBack((string)__value) , new [] {"ViewModel.Name"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_2 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), (___tctx, __value) => ViewModel.MyBindBack((string)__value) , new [] {"ViewModel.Name"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c3 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c4) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c4.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c5) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c5, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c5.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -169,7 +169,7 @@ private void InitializeComponent()
_component_0_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_1
{
get
@@ -181,7 +181,7 @@ private void InitializeComponent()
_component_1_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_2
{
get
@@ -261,5 +261,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE_name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE_name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 7ff7fc66f88d..996b6e0904dd 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE_name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WOPAE_name/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -59,20 +59,20 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 7:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = BindingMode.OneTime,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null ))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = BindingMode.OneTime,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null ))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -81,20 +81,20 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 8:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c1 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_1 = c1;
- c1.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null , new [] {"ViewModel.Name"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c1.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_1 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), null , new [] {"ViewModel.Name"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
@@ -103,61 +103,61 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 9:4)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c2 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_2 = c2;
- c2.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
- }
- .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), (___tctx, __value) => ViewModel.MyBindBack((string)__value) , new [] {"ViewModel.Name"}))
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_2 = __p1;
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.TwoWay,
+ }
+ .BindingApply(___b => /*defaultBindModeOneTime ViewModel.Name.ToUpper()*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? ((true, ___tctx.ViewModel.Name.ToUpper())) : (false, default), (___tctx, __value) => ViewModel.MyBindBack((string)__value) , new [] {"ViewModel.Name"}))
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
,
}
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c3 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c3.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c4) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c4.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c5) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c5, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c5.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new MainPage_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.Update();
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.Update();
+ this.Bindings.UpdateResources();
+ }
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -169,7 +169,7 @@ private void InitializeComponent()
_component_0_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_1
{
get
@@ -181,7 +181,7 @@ private void InitializeComponent()
_component_1_Holder.Instance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_2_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_2
{
get
@@ -261,5 +261,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WSXN/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WSXN/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
index 978b5658cfea..7005f80dfc2c 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WSXN/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WSXN/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs
@@ -53,27 +53,27 @@ private void InitializeComponent()
IsParsing = true,
// Source 0\MainPage.xaml (Line 7:3)
}
- .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c0.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c1) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Source 0\MainPage.xaml (Line 1:2)
-
- // WARNING Property c1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\MainPage.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c2) =>
+ .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- // Class TestRepro.MainPage
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
- c2.CreationComplete();
+ // Class TestRepro.MainPage
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d);
+ __p1.CreationComplete();
}
))
;
@@ -94,5 +94,12 @@ static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler1(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler1 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXB/XamlCodeGenerator_ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXB/XamlCodeGenerator_ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5.cs
index ce2a62534f77..f1298c4240a1 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXB/XamlCodeGenerator_ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXB/XamlCodeGenerator_ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5.cs
@@ -52,19 +52,19 @@ private void InitializeComponent()
PrimaryButtonText = global::Uno.UI.Helpers.MarkupHelper.GetResourceStringForXUid("TestProject/Resources", "XuidGeneratorErrorUid/PrimaryButtonText");
this
- .GenericApply(((c0) =>
+ .ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5_XamlApply((ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5XamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- // Source 0\ContentDialog1.xaml (Line 1:2)
-
- // WARNING Property c0.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}ContentDialog, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\ContentDialog1.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}ContentDialog, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c1) =>
+ .ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5_XamlApply((ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5XamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- // Class TestRepro.XuidGeneratorError
- global::Uno.UI.Helpers.MarkupHelper.SetXUid(c1, "XuidGeneratorErrorUid");
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5);
- c1.CreationComplete();
+ // Class TestRepro.XuidGeneratorError
+ global::Uno.UI.Helpers.MarkupHelper.SetXUid(__p1, "XuidGeneratorErrorUid");
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5);
+ __p1.CreationComplete();
}
))
;
@@ -78,5 +78,12 @@ namespace MyProject
{
static class ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5XamlApplyExtensions
{
+ public delegate void XamlApplyHandler0(global::Microsoft.UI.Xaml.Controls.ContentDialog instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.ContentDialog ContentDialog1_4483f06b3f5899cc3b98f0345eeea8e5_XamlApply(this global::Microsoft.UI.Xaml.Controls.ContentDialog instance, XamlApplyHandler0 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXOWCP/XamlCodeGenerator_Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXOWCP/XamlCodeGenerator_Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f.cs
index 74a748900e00..4e6a057101e0 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXOWCP/XamlCodeGenerator_Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXOWCP/XamlCodeGenerator_Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f.cs
@@ -69,71 +69,71 @@ private void InitializeComponent()
Tag = @"42",
// Source 0\Binding_Xaml_Object_With_Common_Properties.xaml (Line 14:10)
}
- .Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f_XamlApply((Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94fXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f_XamlApply((Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94fXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- __nameScope.RegisterName("topLevel", c0);
- __that.topLevel = c0;
- // FieldModifier public
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Path = @"Tag",
- ElementName = _topLevelSubject,
- Converter = (global::Microsoft.UI.Xaml.Data.IValueConverter)global::Uno.UI.ResourceResolverSingleton.Instance.ResolveResourceStatic("Binding_Xaml_Object_With_Common_Properties_Return_Value_Converter", typeof(global::Microsoft.UI.Xaml.Data.IValueConverter), context: global::MyProject.GlobalStaticResources.__ParseContext_),
- ConverterParameter = @"topLevel",
- ConverterLanguage = "topLevel",
- UpdateSourceTrigger = global::Microsoft.UI.Xaml.Data.UpdateSourceTrigger.Default,
- TargetNullValue = @"TargetNullValue",
- FallbackValue = @"FallbackValue",
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
- RelativeSource = new RelativeSource(RelativeSourceMode.None),
- Source = @"Source",
- }
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __nameScope.RegisterName("topLevel", __p1);
+ __that.topLevel = __p1;
+ // FieldModifier public
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Path = @"Tag",
+ ElementName = _topLevelSubject,
+ Converter = (global::Microsoft.UI.Xaml.Data.IValueConverter)global::Uno.UI.ResourceResolverSingleton.Instance.ResolveResourceStatic("Binding_Xaml_Object_With_Common_Properties_Return_Value_Converter", typeof(global::Microsoft.UI.Xaml.Data.IValueConverter), context: global::MyProject.GlobalStaticResources.__ParseContext_),
+ ConverterParameter = @"topLevel",
+ ConverterLanguage = "topLevel",
+ UpdateSourceTrigger = global::Microsoft.UI.Xaml.Data.UpdateSourceTrigger.Default,
+ TargetNullValue = @"TargetNullValue",
+ FallbackValue = @"FallbackValue",
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
+ RelativeSource = new RelativeSource(RelativeSourceMode.None),
+ Source = @"Source",
+ }
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f);
+ __p1.CreationComplete();
}
))
,
}
}
- .Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f_XamlApply((Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94fXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f_XamlApply((Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94fXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f_XamlApply((Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94fXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\Binding_Xaml_Object_With_Common_Properties.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\Binding_Xaml_Object_With_Common_Properties.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f_XamlApply((Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94fXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class Uno.UI.Tests.Windows_UI_Xaml_Data.BindingTests.Controls.Binding_Xaml_Object_With_Common_Properties
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f);
- c3.CreationComplete();
+ // Class Uno.UI.Tests.Windows_UI_Xaml_Data.BindingTests.Controls.Binding_Xaml_Object_With_Common_Properties
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new Binding_Xaml_Object_With_Common_Properties_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.UpdateResources();
+ }
private global::Microsoft.UI.Xaml.Data.ElementNameSubject _topLevelSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
public global::Microsoft.UI.Xaml.Controls.TextBlock topLevel
{
@@ -146,7 +146,7 @@ private void InitializeComponent()
_topLevelSubject.ElementInstance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -221,5 +221,12 @@ static class Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page Binding_Xaml_Object_With_Common_Properties_4891310bc693a433ba9a8e9f5113f94f_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXOWXOP/XamlCodeGenerator_Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXOWXOP/XamlCodeGenerator_Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f.cs
index a2fac3b32d81..2ae263c0e244 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXOWXOP/XamlCodeGenerator_Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WXOWXOP/XamlCodeGenerator_Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f.cs
@@ -61,71 +61,71 @@ private void InitializeComponent()
Tag = @"42",
// Source 0\Binding_Xaml_Object_With_Xaml_Object_Properties.xaml (Line 11:10)
}
- .Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f_XamlApply((Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476fXamlApplyExtensions.XamlApplyHandler0)(c0 =>
+ .Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f_XamlApply((Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476fXamlApplyExtensions.XamlApplyHandler0)(__p1 =>
{
- /* _isTopLevelDictionary:False */
- __that._component_0 = c0;
- __nameScope.RegisterName("topLevel", c0);
- __that.topLevel = c0;
- // FieldModifier public
- c0.SetBinding(
- global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
- new Microsoft.UI.Xaml.Data.Binding()
- {
- Path = @"Tag",
- ElementName = _topLevelSubject,
- Converter = new global::Uno.UI.Tests.Windows_UI_Xaml_Data.BindingTests.Controls.Binding_Xaml_Object_With_Xaml_Object_Properties_Return_Value_Converter(),
- ConverterParameter = "topLevel",
- ConverterLanguage = "topLevel",
- UpdateSourceTrigger = global::Microsoft.UI.Xaml.Data.UpdateSourceTrigger.Default,
- TargetNullValue = "TargetNullValue",
- FallbackValue = "FallbackValue",
- Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
- RelativeSource = new RelativeSource(RelativeSourceMode.None),
- Source = "Source",
- }
- );
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f);
- c0.CreationComplete();
+ /* _isTopLevelDictionary:False */
+ __that._component_0 = __p1;
+ __nameScope.RegisterName("topLevel", __p1);
+ __that.topLevel = __p1;
+ // FieldModifier public
+ __p1.SetBinding(
+ global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
+ new Microsoft.UI.Xaml.Data.Binding()
+ {
+ Path = @"Tag",
+ ElementName = _topLevelSubject,
+ Converter = new global::Uno.UI.Tests.Windows_UI_Xaml_Data.BindingTests.Controls.Binding_Xaml_Object_With_Xaml_Object_Properties_Return_Value_Converter(),
+ ConverterParameter = "topLevel",
+ ConverterLanguage = "topLevel",
+ UpdateSourceTrigger = global::Microsoft.UI.Xaml.Data.UpdateSourceTrigger.Default,
+ TargetNullValue = "TargetNullValue",
+ FallbackValue = "FallbackValue",
+ Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay,
+ RelativeSource = new RelativeSource(RelativeSourceMode.None),
+ Source = "Source",
+ }
+ );
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f);
+ __p1.CreationComplete();
}
))
,
}
}
- .Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f_XamlApply((Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476fXamlApplyExtensions.XamlApplyHandler1)(c1 =>
+ .Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f_XamlApply((Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476fXamlApplyExtensions.XamlApplyHandler1)(__p1 =>
{
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f);
- c1.CreationComplete();
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f);
+ __p1.CreationComplete();
}
))
;
this
- .GenericApply(((c2) =>
+ .Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f_XamlApply((Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476fXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Source 0\Binding_Xaml_Object_With_Xaml_Object_Properties.xaml (Line 1:2)
-
- // WARNING Property c2.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
+ // Source 0\Binding_Xaml_Object_With_Xaml_Object_Properties.xaml (Line 1:2)
+
+ // WARNING Property __p1.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator
}
))
- .GenericApply(((c3) =>
+ .Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f_XamlApply((Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476fXamlApplyExtensions.XamlApplyHandler2)(__p1 =>
{
- // Class Uno.UI.Tests.Windows_UI_Xaml_Data.BindingTests.Controls.Binding_Xaml_Object_With_Xaml_Object_Properties
- global::Uno.UI.FrameworkElementHelper.SetBaseUri(c3, __baseUri_Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f);
- c3.CreationComplete();
+ // Class Uno.UI.Tests.Windows_UI_Xaml_Data.BindingTests.Controls.Binding_Xaml_Object_With_Xaml_Object_Properties
+ global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f);
+ __p1.CreationComplete();
}
))
;
OnInitializeCompleted();
Bindings = new Binding_Xaml_Object_With_Xaml_Object_Properties_Bindings(this);
- ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>
- {
- __that.Bindings.UpdateResources();
- }
- ;
+ ((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;
}
partial void OnInitializeCompleted();
+ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)
+ {
+ this.Bindings.UpdateResources();
+ }
private global::Microsoft.UI.Xaml.Data.ElementNameSubject _topLevelSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();
public global::Microsoft.UI.Xaml.Controls.TextBlock topLevel
{
@@ -138,7 +138,7 @@ private void InitializeComponent()
_topLevelSubject.ElementInstance = value;
}
}
- private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
+ private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0
{
get
@@ -213,5 +213,12 @@ static class Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f8
handler(instance);
return instance;
}
+ public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.Controls.Page instance);
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static global::Microsoft.UI.Xaml.Controls.Page Binding_Xaml_Object_With_Xaml_Object_Properties_5147419e44d1bc3e3f86860ad528476f_XamlApply(this global::Microsoft.UI.Xaml.Controls.Page instance, XamlApplyHandler2 handler)
+ {
+ handler(instance);
+ return instance;
+ }
}
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Verifiers/CSGenerator.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Verifiers/CSGenerator.cs
index 4423bafb12b3..a7f4fb3b7bd0 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Verifiers/CSGenerator.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Verifiers/CSGenerator.cs
@@ -1,6 +1,6 @@
// Uncomment the following line to write expected files to disk
// Don't commit this line uncommented.
-//#define WRITE_EXPECTED
+// #define WRITE_EXPECTED
using System.Collections.Immutable;
using System.Diagnostics;
@@ -107,7 +107,7 @@ protected TestBase(XamlFile[] xamlFiles, ResourceFile[] resourceFiles, string te
_testFilePath = testFilePath;
_testMethodName = testMethodName;
- ReferenceAssemblies = ReferenceAssemblies.Net.Net80;
+ ReferenceAssemblies = _Dotnet.Current.ReferenceAssemblies;
#if WRITE_EXPECTED
TestBehaviors |= TestBehaviors.SkipGeneratedSourcesCheck;
@@ -125,6 +125,7 @@ protected override async Task RunImplAsync(CancellationToken cancellationToken)
}
else if (ReferenceAssemblies.Packages.Any(p =>
p.Id.StartsWith("Microsoft.iOS.Ref", StringComparison.OrdinalIgnoreCase) ||
+ p.Id.StartsWith("Microsoft.tvOS.Ref", StringComparison.OrdinalIgnoreCase) ||
p.Id.StartsWith("Microsoft.MacCatalyst.Ref", StringComparison.OrdinalIgnoreCase)))
{
includeXamlNamespaces = "ios,not_android,not_wasm,not_macos,not_skia,not_netstdref";
@@ -311,9 +312,14 @@ private static MetadataReference[] BuildUnoReferences()
#endif
var availableTargets = new[] {
+ // On CI the test assemblies set must be first, as it contains all
+ // dependent assemblies, which the other platforms don't (see DisablePrivateProjectReference).
+ Path.Combine("Uno.UI.Tests", configuration, "net8.0"),
Path.Combine("Uno.UI.Skia", configuration, "net8.0"),
Path.Combine("Uno.UI.Reference", configuration, "net8.0"),
- Path.Combine("Uno.UI.Tests", configuration, "net8.0"),
+ Path.Combine("Uno.UI.Tests", configuration, "net9.0"),
+ Path.Combine("Uno.UI.Skia", configuration, "net9.0"),
+ Path.Combine("Uno.UI.Reference", configuration, "net9.0"),
};
var unoUIBase = Path.Combine(
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/_Dotnet.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/_Dotnet.cs
new file mode 100644
index 000000000000..85fef5b499a0
--- /dev/null
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/_Dotnet.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Linq;
+using Microsoft.CodeAnalysis.Testing;
+
+namespace Uno.UI.SourceGenerators.Tests;
+
+internal record class _Dotnet(string Moniker, ReferenceAssemblies ReferenceAssemblies)
+{
+ public ReferenceAssemblies WithUnoPackage(string version = "5.0.118")
+ => ReferenceAssemblies.AddPackages([new PackageIdentity("Uno.WinUI", version)]);
+
+ public static _Dotnet Previous = new("net8.0", ReferenceAssemblies.Net.Net80);
+
+ public static _Dotnet Current = new("net9.0", ReferenceAssemblies.Net.Net90);
+
+ public static _Dotnet CurrentAndroid = new("net9.0-android", ReferenceAssemblies.Net.Net90Android);
+}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/Content/Uno.UI.SourceGenerators.props b/src/SourceGenerators/Uno.UI.SourceGenerators/Content/Uno.UI.SourceGenerators.props
index cea123ca4cf3..0f02c73d1526 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators/Content/Uno.UI.SourceGenerators.props
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators/Content/Uno.UI.SourceGenerators.props
@@ -64,6 +64,7 @@
+
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs
index 79f4c8b1df25..e579923b8ae7 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs
@@ -46,6 +46,7 @@ public class RemoteControlGenerator : ISourceGenerator
"SolutionName",
"VSIDEResolvedNonMSBuildProjectOutputs",
"DevEnvDir",
+ "MSBuildVersion",
};
public void Initialize(GeneratorInitializationContext context)
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/NameScope.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/NameScope.cs
index 48e7ceb81451..41c1efcb2f49 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/NameScope.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/NameScope.cs
@@ -1,6 +1,8 @@
#nullable enable
+using System;
using System.Collections.Generic;
+using Uno.Extensions;
namespace Uno.UI.SourceGenerators.XamlGenerator
{
@@ -19,29 +21,33 @@ public NameScope(string? @namespace, string className)
///
/// Used to detect duplicate x:Name and report error for those.
///
- public HashSet DeclaredNames { get; } = new HashSet();
+ public HashSet DeclaredNames { get; } = [];
- public List BackingFields { get; } = new List();
+ public List BackingFields { get; } = [];
///
/// List of action handlers for registering x:Bind events
///
- public List xBindEventsHandlers { get; } = new();
+ public List xBindEventsHandlers { get; } = [];
///
/// Lists the ElementStub builder holder variables used to pin references for implicit pinning platforms
///
- public List ElementStubHolders { get; } = new List();
+ public List ElementStubHolders { get; } = [];
- public HashSet ReferencedElementNames { get; } = new HashSet();
+ public HashSet ReferencedElementNames { get; } = [];
- public Dictionary Subclasses { get; } = new Dictionary();
+ public Dictionary Subclasses { get; } = [];
- public List Components { get; } = new List();
+ public List Components { get; } = [];
- public List XBindExpressions { get; } = new List();
+ public List XBindExpressions { get; } = [];
- public List XBindTryGetMethodDeclarations { get; } = new List();
+ public List XBindTryGetMethodDeclarations { get; } = [];
+
+ public List ExplicitApplyMethods { get; } = [];
+
+ public List> EventHandlers { get; } = [];
public int ComponentCount => Components.Count;
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs
index 9c46c9a78a15..8d67fdc9b457 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.cs
@@ -680,7 +680,7 @@ private SourceText GenerateGlobalResources(IEnumerable files
writer.AppendLineIndented("/// Contains all the static resources defined for the application");
writer.AppendLineIndented("/// ");
- if (_isDebug)
+ if (_isHotReloadEnabled)
{
writer.AppendLineIndented("[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]");
}
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs
index 1af7fa57c6be..b422b1f943d8 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs
@@ -367,18 +367,8 @@ private SourceText InnerGenerateFile()
var controlBaseType = GetType(topLevelControl.Type);
- WriteMetadataNewTypeAttribute(writer);
-
using (writer.BlockInvariant("partial class {0} : {1}", _xClassName.ClassName, controlBaseType.GetFullyQualifiedTypeIncludingGlobal()))
{
- if (_isHotReloadEnabled)
- {
- // Create a public member to avoid having to remove all unused member warnings
- // The member is a method to avoid this error: error ENC0011: Updating the initializer of const field requires restarting the application.
- writer.AppendLineIndented("[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]");
- writer.AppendLineIndented($"internal string __checksum() => \"{_fileDefinition.Checksum}\";");
- }
-
BuildBaseUri(writer);
using (Scope(_xClassName.Namespace, _xClassName.ClassName))
@@ -395,6 +385,10 @@ private SourceText InnerGenerateFile()
BuildPartials(writer);
+ BuildEventHandlers(writer);
+
+ BuildExplicitApplyMethods(writer);
+
BuildBackingFields(writer);
BuildChildSubclasses(writer);
@@ -441,18 +435,6 @@ private void BuildInitializeComponent(IndentedStringBuilder writer, XamlObjectDe
}
else
{
- if (_isHotReloadEnabled)
- {
- // Insert hot reload support
- writer.AppendLineIndented($"var __resourceLocator = new global::System.Uri(\"file:///{_fileDefinition.FilePath.Replace("\\", "/")}\");");
-
- using (writer.BlockInvariant($"if(global::Uno.UI.ApplicationHelper.IsLoadableComponent(__resourceLocator))"))
- {
- writer.AppendLineIndented($"global::Microsoft.UI.Xaml.Application.LoadComponent(this, __resourceLocator);");
- writer.AppendLineIndented($"return;");
- }
- }
-
BuildGenericControlInitializerBody(writer, topLevelControl);
BuildNamedResources(writer, _namedResources);
}
@@ -470,8 +452,6 @@ private void BuildXamlApplyBlocks(IndentedStringBuilder writer)
{
using (writer.BlockInvariant("namespace {0}", _defaultNamespace))
{
- WriteMetadataNewTypeAttribute(writer);
-
using (writer.BlockInvariant("static class {0}XamlApplyExtensions", _fileUniqueId))
{
foreach (var typeInfo in _xamlAppliedTypes)
@@ -548,7 +528,7 @@ void ApplyLiteralProperties()
{
writer.AppendLineIndented("this");
- using (var blockWriter = CreateApplyBlock(writer, null, out var closure))
+ using (var blockWriter = CreateApplyBlock(writer, FindType(topLevelControl.Type), out var closure))
{
blockWriter.AppendLineInvariantIndented(
"// Source {0} (Line {1}:{2})",
@@ -794,7 +774,8 @@ private void BuildGenericControlInitializerBody(IndentedStringBuilder writer, Xa
writer.AppendLineIndented("this");
- using (var blockWriter = CreateApplyBlock(writer, null, out var closure))
+
+ using (var blockWriter = CreateApplyBlock(writer, topLevelControlType, out var closure))
{
blockWriter.AppendLineInvariantIndented(
"// Source {0} (Line {1}:{2})",
@@ -830,6 +811,15 @@ private void BuildPartials(IIndentedStringBuilder writer)
}
}
+ private void BuildExplicitApplyMethods(IIndentedStringBuilder writer)
+ {
+ TryAnnotateWithGeneratorSource(writer);
+ foreach (var applyMethod in CurrentScope.ExplicitApplyMethods)
+ {
+ writer.AppendLineIndented(applyMethod);
+ }
+ }
+
private void BuildXBindTryGetDeclarations(IIndentedStringBuilder writer)
{
foreach (var xBindMethodDeclaration in CurrentScope.XBindTryGetMethodDeclarations)
@@ -838,8 +828,18 @@ private void BuildXBindTryGetDeclarations(IIndentedStringBuilder writer)
}
}
+ private void BuildEventHandlers(IIndentedStringBuilder writer)
+ {
+ foreach (var eventHandler in CurrentScope.EventHandlers)
+ {
+ eventHandler(writer);
+ }
+ }
+
private void BuildBackingFields(IIndentedStringBuilder writer)
{
+ var rAccessor = _isHotReloadEnabled ? " { get; set; }" : null; // We use property for HR so we can remove them without causing rude edit.
+
TryAnnotateWithGeneratorSource(writer);
foreach (var backingFieldDefinition in CurrentScope.BackingFields.Distinct())
{
@@ -850,8 +850,7 @@ private void BuildBackingFields(IIndentedStringBuilder writer)
CurrentScope.ReferencedElementNames.Remove(sanitizedFieldName);
}
- writer.AppendLineIndented($"private global::Microsoft.UI.Xaml.Data.ElementNameSubject _{sanitizedFieldName}Subject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();");
-
+ writer.AppendLineIndented($"private global::Microsoft.UI.Xaml.Data.ElementNameSubject _{sanitizedFieldName}Subject{rAccessor} = new global::Microsoft.UI.Xaml.Data.ElementNameSubject();");
using (writer.BlockInvariant($"{FormatAccessibility(backingFieldDefinition.Accessibility)} {backingFieldDefinition.GlobalizedTypeName} {sanitizedFieldName}"))
{
@@ -870,13 +869,13 @@ private void BuildBackingFields(IIndentedStringBuilder writer)
foreach (var xBindEventHandler in CurrentScope.xBindEventsHandlers)
{
// Create load-time subjects for ElementName references not in local scope
- writer.AppendLineIndented($"{FormatAccessibility(xBindEventHandler.Accessibility)} {xBindEventHandler.GlobalizedTypeName} {xBindEventHandler.Name};");
+ writer.AppendLineIndented($"{FormatAccessibility(xBindEventHandler.Accessibility)} {xBindEventHandler.GlobalizedTypeName} {xBindEventHandler.Name}{rAccessor ?? ";"}");
}
foreach (var remainingReference in CurrentScope.ReferencedElementNames)
{
// Create load-time subjects for ElementName references not in local scope
- writer.AppendLineIndented($"private global::Microsoft.UI.Xaml.Data.ElementNameSubject _{remainingReference}Subject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject(isRuntimeBound: true, name: \"{remainingReference}\");");
+ writer.AppendLineIndented($"private global::Microsoft.UI.Xaml.Data.ElementNameSubject _{remainingReference}Subject{rAccessor} = new global::Microsoft.UI.Xaml.Data.ElementNameSubject(isRuntimeBound: true, name: \"{remainingReference}\");");
}
}
@@ -913,36 +912,20 @@ private void BuildChildSubclasses(IIndentedStringBuilder writer, bool isTopLevel
{
using (Scope(ns, className))
{
- var hrInterfaceName = _isHotReloadEnabled ? $"I{className}" : "";
- var hrInterfaceImpl = _isHotReloadEnabled ? $": {hrInterfaceName}" : "";
-
- if (_isHotReloadEnabled)
- {
- // Build an interface that can be used to hide the actual replaced
- // implementation of a type during hot reload.
- using (writer.BlockInvariant($"internal interface {hrInterfaceName}"))
- {
-#if USE_NEW_TP_CODEGEN
- writer.AppendLineIndented($"{kvp.Value.ReturnType} Build(object owner, global::Microsoft.UI.Xaml.TemplateMaterializationSettings __settings);");
-#else
- writer.AppendLineIndented($"{kvp.Value.ReturnType} Build(object owner);");
-#endif
- }
- }
-
var classAccessibility = isTopLevel ? "" : "private";
- WriteMetadataNewTypeAttribute(writer);
writer.AppendLineIndented("[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]");
writer.AppendLineIndented("[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage(\"Trimming\", \"IL2026\")]");
writer.AppendLineIndented("[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage(\"Trimming\", \"IL2111\")]");
- using (writer.BlockInvariant($"{classAccessibility} class {className} {hrInterfaceImpl}"))
+ using (writer.BlockInvariant($"{classAccessibility} class {className}"))
{
BuildBaseUri(writer);
using (ResourceOwnerScope())
{
writer.AppendLineIndented("global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope();");
+ writer.AppendLineIndented($"global::System.Object {CurrentResourceOwner};");
+ writer.AppendLineIndented($"{kvp.Value.ReturnType} __rootInstance = null;");
#if USE_NEW_TP_CODEGEN
using (writer.BlockInvariant($"public {kvp.Value.ReturnType} Build(object {CurrentResourceOwner}, global::Microsoft.UI.Xaml.TemplateMaterializationSettings __settings)"))
@@ -950,9 +933,9 @@ private void BuildChildSubclasses(IIndentedStringBuilder writer, bool isTopLevel
using (writer.BlockInvariant($"public {kvp.Value.ReturnType} Build(object {CurrentResourceOwner})"))
#endif
{
- writer.AppendLineIndented($"{kvp.Value.ReturnType} __rootInstance = null;");
writer.AppendLineIndented($"var __that = this;");
- writer.AppendLineIndented("__rootInstance = ");
+ writer.AppendLineIndented($"this.{CurrentResourceOwner} = {CurrentResourceOwner};");
+ writer.AppendLineIndented("this.__rootInstance = ");
// Is never considered in Global Resources because class encapsulation
BuildChild(writer, contentOwner, contentOwner.Objects.First());
@@ -982,6 +965,10 @@ private void BuildChildSubclasses(IIndentedStringBuilder writer, bool isTopLevel
BuildBackingFields(writer);
+ BuildEventHandlers(writer);
+
+ BuildExplicitApplyMethods(writer);
+
BuildChildSubclasses(writer);
BuildXBindTryGetDeclarations(writer);
@@ -1037,45 +1024,43 @@ private void BuildCompiledBindingsInitializer(IndentedStringBuilder writer, INam
if (hasXBindExpressions || hasResourceExtensions)
{
- var activator = _isHotReloadEnabled
- ? $"(({GetBindingsTypeNames(_xClassName.ClassName).bindingsInterfaceName})global::Uno.UI.Helpers.TypeMappings.CreateInstance<{GetBindingsTypeNames(_xClassName.ClassName).bindingsClassName}>(this))"
- : $"new {GetBindingsTypeNames(_xClassName.ClassName).bindingsClassName}(this)";
+ var activator = $"new {GetBindingsTypeNames(_xClassName.ClassName).bindingsClassName}(this)";
writer.AppendLineIndented($"Bindings = {activator};");
}
if ((isFrameworkElement || isWindow) && (hasXBindExpressions || hasResourceExtensions))
{
- if (_isHotReloadEnabled)
- {
- // Attach the current context to itself to avoid having a closure in the lambda
- writer.AppendLineIndented($"global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__that, \"owner\", __that);");
- }
-
// Casting to FrameworkElement or Window is important to avoid issues when there
// is a member named Loading or Activated that shadows the ones from FrameworkElement/Window
- var eventSubscription = isFrameworkElement
- ? "((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += (s, e) =>"
- : "((global::Microsoft.UI.Xaml.Window)this).Activated += (s, e) =>";
- using (writer.BlockInvariant(eventSubscription))
+ string callbackSignature;
+ if (isFrameworkElement)
{
- if (_isHotReloadEnabled && _xClassName.Symbol != null)
- {
- writer.AppendLineIndented($"var __that = global::Uno.UI.Helpers.MarkupHelper.GetElementProperty<{_xClassName.Symbol?.GetFullyQualifiedTypeIncludingGlobal()}>(s, \"owner\");");
- }
+ callbackSignature = "private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)";
+ writer.AppendLineIndented("((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources;");
+ }
+ else
+ {
+ callbackSignature = "private void __UpdateBindingsAndResources(object s, global::Microsoft.UI.Xaml.WindowActivatedEventArgs e)";
+ writer.AppendLineIndented("((global::Microsoft.UI.Xaml.Window)this).Activated += __UpdateBindingsAndResources;");
+ }
- if (hasXBindExpressions)
+ CurrentScope.EventHandlers.Add(eventWriter =>
+ {
+ using (eventWriter.BlockInvariant(callbackSignature))
{
- writer.AppendLineIndented("__that.Bindings.Update();");
- }
-
- writer.AppendLineIndented("__that.Bindings.UpdateResources();");
- }
+ if (hasXBindExpressions)
+ {
+ eventWriter.AppendLineIndented("this.Bindings.Update();");
+ }
- writer.AppendLineIndented(";");
+ eventWriter.AppendLineIndented("this.Bindings.UpdateResources();");
+ }
+ });
}
}
+
private void BuildCompiledBindingsInitializerForTemplate(IIndentedStringBuilder writer)
{
TryAnnotateWithGeneratorSource(writer);
@@ -1083,17 +1068,21 @@ private void BuildCompiledBindingsInitializerForTemplate(IIndentedStringBuilder
if (hasResourceExtensions)
{
- using (writer.BlockInvariant($"if (__rootInstance is FrameworkElement __fe) "))
+ using (writer.BlockInvariant($"if (__rootInstance is FrameworkElement __fe)"))
{
- writer.AppendLineIndented($"var owner = this;");
+ writer.AppendLineIndented("__fe.Loading += __UpdateBindingsAndResources;");
- using (writer.BlockInvariant($"__fe.Loading += delegate"))
+ CurrentScope.EventHandlers.Add(eventWriter =>
{
- BuildComponentResouceBindingUpdates(writer);
- BuildXBindApply(writer);
- BuildxBindEventHandlerInitializers(writer, CurrentScope.xBindEventsHandlers);
- }
- writer.AppendLineIndented(";");
+ using (writer.BlockInvariant("private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)"))
+ {
+ eventWriter.AppendLineIndented("var owner = this;");
+
+ BuildComponentResouceBindingUpdates(eventWriter);
+ BuildXBindApply(eventWriter);
+ BuildxBindEventHandlerInitializers(eventWriter, CurrentScope.xBindEventsHandlers);
+ }
+ });
}
}
}
@@ -1147,10 +1136,8 @@ private void BuildComponentFields(IIndentedStringBuilder writer)
var typeName = GetType(current.XamlObject.Type).GetFullyQualifiedTypeIncludingGlobal();
var isWeak = current.IsWeakReference ? "true" : "false";
-
- // As of C# 7.0, C# Hot Reload does not support the renaming fields.
- var propertySyntax = _isHotReloadEnabled ? "{ get; }" : "";
- writer.AppendLineIndented($"private global::Microsoft.UI.Xaml.Markup.ComponentHolder {componentName}_Holder {propertySyntax} = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: {isWeak});");
+ var accessors = _isHotReloadEnabled ? " { get; }" : ""; // We use property for HR so we can remove them without causing rude edit.
+ writer.AppendLineIndented($"private global::Microsoft.UI.Xaml.Markup.ComponentHolder {componentName}_Holder{accessors} = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: {isWeak});");
using (writer.BlockInvariant($"private {typeName} {componentName}"))
{
@@ -1174,7 +1161,7 @@ private void BuildCompiledBindings(IndentedStringBuilder writer)
var hasXBindExpressions = CurrentScope.XBindExpressions.Count != 0;
var hasResourceExtensions = CurrentScope.Components.Any(c => HasMarkupExtensionNeedingComponent(c.XamlObject));
- if (hasXBindExpressions || hasResourceExtensions)
+ if (hasXBindExpressions || hasResourceExtensions || _isHotReloadEnabled) // We forcefully generate the bindings class for HR to avoids rude edit
{
var (bindingsInterfaceName, bindingsClassName) = GetBindingsTypeNames(_xClassName.ClassName);
@@ -1191,8 +1178,6 @@ private void BuildCompiledBindings(IndentedStringBuilder writer)
writer.AppendLineIndented($"private {bindingsInterfaceName} Bindings;");
writer.AppendLineIndented($"#pragma warning restore 0169");
- WriteMetadataNewTypeAttribute(writer);
-
writer.AppendLineIndented($"[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
using (writer.BlockInvariant($"private class {bindingsClassName} : {bindingsInterfaceName}"))
{
@@ -1331,19 +1316,19 @@ private void BuildTopLevelResourceDictionary(IIndentedStringBuilder writer, Xaml
{
BuildBaseUri(writer);
- if (_isHotReloadEnabled)
- {
- // Create a public member to avoid having to remove all unused member warnings
- // The member is a method to avoid this error: error ENC0011: Updating the initializer of const field requires restarting the application.
- writer.AppendLineIndented("[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]");
- writer.AppendLineIndented($"internal string __{_fileDefinition.UniqueID}_checksum() => \"{_fileDefinition.Checksum}\";");
- }
-
IDisposable WrapSingleton()
{
writer.AppendLineIndented("// This non-static inner class is a means of reducing size of AOT compilations by avoiding many accesses to static members from a static callsite, which adds costly class initializer checks each time.");
- WriteMetadataNewTypeAttribute(writer);
+ if (_isHotReloadEnabled)
+ {
+ // Create a public member to avoid having to remove all unused member warnings
+ // The member is a method to avoid this error: error ENC0011: Updating the initializer of const field requires restarting the application.
+ writer.AppendLineIndented("[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]");
+ writer.AppendLineIndented($"internal string __{_fileDefinition.UniqueID}_checksum() => \"{_fileDefinition.Checksum}\";");
+
+ writer.AppendLineIndented("[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]");
+ }
var block = writer.BlockInvariant("internal sealed class {0} : {1}", SingletonClassName, DictionaryProviderInterfaceName);
_isInSingletonInstance = true;
@@ -1366,9 +1351,7 @@ IDisposable WrapSingleton()
{
using (writer.BlockInvariant("if (__that == null)"))
{
- var activator = _isHotReloadEnabled
- ? $"({DictionaryProviderInterfaceName})global::Uno.UI.Helpers.TypeMappings.CreateInstance<{SingletonClassName}>()"
- : $"new {SingletonClassName}()";
+ var activator = $"new {SingletonClassName}()";
writer.AppendLineInvariantIndented($"__that = {activator};");
}
@@ -1435,6 +1418,8 @@ IDisposable WrapSingleton()
}
BuildXBindTryGetDeclarations(writer);
+
+ BuildEventHandlers(writer);
}
}
@@ -1442,14 +1427,6 @@ IDisposable WrapSingleton()
}
}
- private void WriteMetadataNewTypeAttribute(IIndentedStringBuilder writer)
- {
- if (_isHotReloadEnabled)
- {
- writer.AppendLineIndented("[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]");
- }
- }
-
///
///Build initializers for the current ResourceDictionary.
///
@@ -1755,7 +1732,10 @@ private void BuildResourceDictionaryBackingClass(IIndentedStringBuilder writer,
using (writer.BlockInvariant("namespace {0}", className.Namespace))
{
- WriteMetadataNewTypeAttribute(writer);
+ if (_isHotReloadEnabled)
+ {
+ writer.AppendLineIndented("[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]");
+ }
using (writer.BlockInvariant("public sealed partial class {0} : {1}", className.ClassName, controlBaseType.GetFullyQualifiedTypeIncludingGlobal()))
{
@@ -1777,6 +1757,7 @@ private void BuildResourceDictionaryBackingClass(IIndentedStringBuilder writer,
writer.AppendLine();
+ BuildEventHandlers(writer);
BuildChildSubclasses(writer);
BuildXBindTryGetDeclarations(writer);
}
@@ -1861,16 +1842,20 @@ bool IsGenerateUpdateResourceBindings(KeyValuePair
if (resourcesTogenerateUpdateBindings.Length > 0)
{
- using (writer.BlockInvariant("Loading += (s, e) =>"))
+ writer.AppendLineIndented("Loading += __UpdateNamedResources;");
+
+ CurrentScope.EventHandlers.Add(eventWriter =>
{
- foreach (var namedResource in resourcesTogenerateUpdateBindings)
+ using (eventWriter.BlockInvariant("private void __UpdateNamedResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e)"))
{
- var type = GetType(namedResource.Value.Type);
+ foreach (var namedResource in resourcesTogenerateUpdateBindings)
+ {
+ var type = GetType(namedResource.Value.Type);
- writer.AppendLineIndented($"{namedResource.Key}.UpdateResourceBindings();");
+ eventWriter.AppendLineIndented($"{namedResource.Key}.UpdateResourceBindings();");
+ }
}
- }
- writer.AppendLineIndented(";");
+ });
}
}
@@ -2805,7 +2790,9 @@ private IDisposable BuildLazyResourceInitializer(IIndentedStringBuilder writer)
var currentScope = CurrentResourceOwnerName;
var resourceOwnerScope = ResourceOwnerScope();
- writer.AppendLineIndented($"new global::Uno.UI.Xaml.WeakResourceInitializer({currentScope}, {CurrentResourceOwner} => ");
+ var bodyDisposable = writer.BlockInvariant($"new global::Uno.UI.Xaml.WeakResourceInitializer({currentScope}, {CurrentResourceOwner} => ");
+
+ writer.AppendLineInvariantIndented($"return ");
var indent = writer.Indent();
@@ -2813,6 +2800,8 @@ private IDisposable BuildLazyResourceInitializer(IIndentedStringBuilder writer)
{
resourceOwnerScope.Dispose();
indent.Dispose();
+ writer.AppendLineInvariantIndented(";");
+ bodyDisposable.Dispose();
writer.AppendLineIndented(")");
});
}
@@ -3073,7 +3062,7 @@ private void BuildExtendedProperties(IIndentedStringBuilder outerwriter, XamlObj
throw new InvalidOperationException("The type {0} could not be found".InvariantCultureFormat(objectDefinition.Type));
}
- using (var writer = CreateApplyBlock(outerwriter, useGenericApply ? null : objectDefinitionType, out closureName))
+ using (var writer = CreateApplyBlock(outerwriter, objectDefinitionType, out closureName))
{
XamlMemberDefinition? uidMember = null;
XamlMemberDefinition? nameMember = null;
@@ -3172,7 +3161,7 @@ private void BuildExtendedProperties(IIndentedStringBuilder outerwriter, XamlObj
}
else
{
- BuildCustomMarkupExtensionPropertyValue(writer, member, closureName);
+ BuildCustomMarkupExtensionPropertyValue(writer, member, closureName, _isTopLevelDictionary ? null : $"(({CurrentScope.ClassName})__that)");
}
}
else if (member.Objects.Count > 0)
@@ -3534,9 +3523,9 @@ private void BuildExtendedProperties(IIndentedStringBuilder outerwriter, XamlObj
}
// Local function used to build a property/value for any custom MarkupExtensions
- void BuildCustomMarkupExtensionPropertyValue(IIndentedStringBuilder writer, XamlMemberDefinition member, string closure)
+ void BuildCustomMarkupExtensionPropertyValue(IIndentedStringBuilder writer, XamlMemberDefinition member, string closure, string? resourceOwner)
{
- var propertyValue = GetCustomMarkupExtensionValue(member, closure);
+ var propertyValue = GetCustomMarkupExtensionValue(member, closure, resourceOwner);
if (!propertyValue.IsNullOrEmpty())
{
writer.AppendIndented($"{closure}.{member.Member.Name} = {propertyValue};\r\n");
@@ -3677,7 +3666,7 @@ IMethodSymbol FindTargetMethodSymbol(INamedTypeSymbol? sourceType)
// Use of __rootInstance is required to get the top-level DataContext, as it may be changed
// in the current visual tree by the user.
- $"(__rootInstance as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference",
+ $"(__that.__rootInstance as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference",
FindTargetMethodSymbol(dataTypeSymbol)
);
}
@@ -3730,6 +3719,7 @@ IMethodSymbol FindTargetMethodSymbol(INamedTypeSymbol? sourceType)
writer.AppendLineIndented($"global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__owner, \"{eventTarget}\", {thatVariableName});");
}
+ //CurrentScope.ExplicitApplyMethods ICI
using (writer.BlockInvariant($"/* first level targetMethod:{targetContext.targetMethod} */ __owner.{member.Member.Name} += ({parms}) => "))
{
if (isStaticTarget)
@@ -3766,7 +3756,8 @@ IMethodSymbol FindTargetMethodSymbol(INamedTypeSymbol? sourceType)
// use the WeakReferenceProvider to get a self reference to avoid adding the cost of the
// creation of a WeakReference.
//
- writer.AppendLineIndented($"var {member.Member.Name}_{sanitizedMemberValue}_That = ({eventSource} as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;");
+ var thatEventSource = eventSource != "__that" ? "__that." + eventSource : eventSource;
+ writer.AppendLineIndented($"var {member.Member.Name}_{sanitizedMemberValue}_That = ({thatEventSource} as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference;");
writer.AppendLineIndented($"/* second level */ {closureName}.{member.Member.Name} += ({parms}) => ({member.Member.Name}_{sanitizedMemberValue}_That.Target as {_xClassName})?.{member.Value}({parms});");
}
@@ -3938,8 +3929,7 @@ private void BuildSetAttachedProperty(IIndentedStringBuilder writer, string clos
private XamlLazyApplyBlockIIndentedStringBuilder CreateApplyBlock(IIndentedStringBuilder writer, INamedTypeSymbol? appliedType, out string closureName)
{
TryAnnotateWithGeneratorSource(writer);
- closureName = "c" + (_applyIndex++).ToString(CultureInfo.InvariantCulture);
-
+ closureName = "__p1";
//
// Since we're using strings to generate the code, we can't know ahead of time if
// content will be generated only by looking at the Xaml object model.
@@ -3975,7 +3965,16 @@ private XamlLazyApplyBlockIIndentedStringBuilder CreateApplyBlock(IIndentedStrin
closureName,
appliedType != null && !_isHotReloadEnabled ? _fileUniqueId : null,
delegateType,
- !_isTopLevelDictionary && _isHotReloadEnabled);
+ !_isTopLevelDictionary,
+ RegisterApplyMethod,
+ appliedType?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) ?? "global::System.Object",
+ CurrentScope.ClassName,
+ $"ApplyMethod_{(_applyIndex++).ToString(CultureInfo.InvariantCulture)}");
+ }
+
+ private void RegisterApplyMethod(string applyMethodBody)
+ {
+ CurrentScope.ExplicitApplyMethods.Add(applyMethodBody);
}
private void RegisterPartial(string format, params object[] values)
@@ -4264,7 +4263,7 @@ private string BuildXBindEvalFunction(XamlMemberDefinition member, XamlObjectDef
var sourceInstance = CurrentResourceOwner is not null ? CurrentResourceOwnerName : "__that";
var applyBindingParameters = _isHotReloadEnabled
- ? $"{sourceInstance}, (___b, {sourceInstance})"
+ ? $"{sourceInstance}, (___b, __that)"
: "___b";
if (isInsideDataTemplate)
@@ -4623,7 +4622,7 @@ private string BuildMemberPropertyValue(XamlMemberDefinition m, bool isTemplateB
}
}
- private string GetCustomMarkupExtensionValue(XamlMemberDefinition member, string? target = null)
+ private string GetCustomMarkupExtensionValue(XamlMemberDefinition member, string? target = null, string? resourceOwner = null)
{
// Get the type of the custom markup extension
var markup = member
@@ -4669,6 +4668,13 @@ private string GetCustomMarkupExtensionValue(XamlMemberDefinition member, string
.JoinBy(", ");
var markupInitializer = !properties.IsNullOrEmpty() ? $" {{ {properties} }}" : "()";
+ var thatCurrentResourceOwnerName = resourceOwner switch
+ {
+ not null => resourceOwner,
+ null when CurrentResourceOwner is { } owner => "__that." + owner,
+ _ => "this"
+ };
+
// Build the parser context for ProvideValue(IXamlServiceProvider)
var providerDetails = new string[]
{
@@ -4678,7 +4684,7 @@ private string GetCustomMarkupExtensionValue(XamlMemberDefinition member, string
$"\"{member.Member.Name}\"",
$"typeof({globalized.PvtpType})",
// the ResourceOwner for an ResDict is the RD's singleton instance, not the RD itself
- $"({CurrentResourceOwnerName} as object as {DictionaryProviderInterfaceName})?.GetResourceDictionary() ?? (object){CurrentResourceOwnerName}",
+ $"({thatCurrentResourceOwnerName} as object as {DictionaryProviderInterfaceName})?.GetResourceDictionary() ?? (object){thatCurrentResourceOwnerName}",
};
var provider = $"{globalized.MarkupHelper}.CreateParserContext({providerDetails.JoinBy(", ")})";
@@ -6429,80 +6435,76 @@ private IEnumerable EnumerateSubElements(IEnumerable(sender, \"{componentName}_owner\");");
+ innerWriter.AppendLineIndented($"var owner = global::Uno.UI.Helpers.MarkupHelper.GetElementProperty<{CurrentScope.ClassName}>(sender, \"{componentName}_owner\");");
}
// Refresh the bindings when the ElementStub is unloaded. This assumes that
// ElementStub will be unloaded **after** the stubbed control has been created
// in order for the component field to be filled, and Bindings.Update() to do its work.
- using (writer.BlockInvariant($"if ({componentName}_update_That.Target is {_xClassName} that)"))
+ using (innerWriter.BlockInvariant($"if ({componentName}_update_That.Target is {_xClassName} that)"))
{
if (CurrentXLoadScope != null)
{
foreach (var component in CurrentXLoadScope.Components)
{
- writer.AppendLineIndented($"that.{component.VariableName}.ApplyXBind();");
- writer.AppendLineIndented($"that.{component.VariableName}.UpdateResourceBindings();");
+ innerWriter.AppendLineIndented($"that.{component.VariableName}.ApplyXBind();");
+ innerWriter.AppendLineIndented($"that.{component.VariableName}.UpdateResourceBindings();");
}
- BuildxBindEventHandlerInitializers(writer, CurrentXLoadScope.xBindEventsHandlers, "that.");
+ BuildxBindEventHandlerInitializers(innerWriter, CurrentXLoadScope.xBindEventsHandlers, "that.");
}
}
}
- writer.AppendLineIndented($"{closureName}.Materializing += {componentName}_materializing;");
+ innerWriter.AppendLineIndented($"{closureName}.Materializing += {componentName}_materializing;");
}
else
{
@@ -6603,9 +6605,8 @@ private void BuildChildThroughSubclass(IIndentedStringBuilder writer, XamlMember
RegisterChildSubclass(subclassName, contentOwner, returnType);
- var activator = _isHotReloadEnabled
- ? $"(({namespacePrefix}I{subclassName})global::Uno.UI.Helpers.TypeMappings.CreateInstance<{namespacePrefix}{subclassName}>())"
- : $"new {namespacePrefix}{subclassName}()";
+ var activator = $"new {namespacePrefix}{subclassName}()";
+
#if USE_NEW_TP_CODEGEN
writer.AppendLineIndented($"{activator}.Build(__owner, __settings)");
#else
diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlLazyApplyBlockIIndentedStringBuilder.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlLazyApplyBlockIIndentedStringBuilder.cs
index 079544d735b5..567fc42a3624 100644
--- a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlLazyApplyBlockIIndentedStringBuilder.cs
+++ b/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlLazyApplyBlockIIndentedStringBuilder.cs
@@ -17,17 +17,27 @@ internal class XamlLazyApplyBlockIIndentedStringBuilder : IIndentedStringBuilder
private bool _applyOpened;
private readonly string _closureName;
private readonly IIndentedStringBuilder _source;
+ private readonly IndentedStringBuilder _inner = new();
private IDisposable? _applyDisposable;
private readonly string? _applyPrefix;
private readonly string? _delegateType;
private readonly IDisposable? _parentDisposable;
private readonly bool _exposeContext;
+ private readonly Action _onRegisterApplyMethodBody;
+ private readonly string? _exposeContextMethod;
+ private readonly string _appliedType;
+ private readonly string _topLevelType;
public XamlLazyApplyBlockIIndentedStringBuilder(
IIndentedStringBuilder source,
- string closureName, string? applyPrefix,
+ string closureName,
+ string? applyPrefix,
string? delegateType,
bool exposeContext,
+ Action onRegisterApplyMethodBody,
+ string appliedType,
+ string topLevelType,
+ string? exposeContextMethod,
IDisposable? parentDisposable = null)
{
_closureName = closureName;
@@ -36,6 +46,10 @@ public XamlLazyApplyBlockIIndentedStringBuilder(
_delegateType = delegateType;
_parentDisposable = parentDisposable;
_exposeContext = exposeContext;
+ _onRegisterApplyMethodBody = onRegisterApplyMethodBody;
+ _exposeContextMethod = exposeContextMethod;
+ _appliedType = appliedType;
+ _topLevelType = topLevelType;
}
private void TryWriteApply()
@@ -44,7 +58,9 @@ private void TryWriteApply()
{
_applyOpened = true;
- IDisposable blockDisposable;
+ _inner.Indent(_source.CurrentLevel);
+
+ IDisposable? blockDisposable;
var delegateString = !_delegateType.IsNullOrEmpty() ? "(" + _delegateType + ")" : "";
@@ -55,7 +71,9 @@ private void TryWriteApply()
else if (_exposeContext)
{
// This syntax is used to avoid closing on __that and __namescope when running in HotReload.
- blockDisposable = _source.BlockInvariant(".GenericApply(__that, __nameScope, {1}(({0}, __that, __nameScope) => ", _closureName, delegateString);
+ _source.AppendIndented($".GenericApply(__that, __nameScope, ({_exposeContextMethod}");
+
+ blockDisposable = _inner.BlockInvariant($"private void {_exposeContextMethod}({_appliedType} {_closureName}, {_topLevelType} __that, global::Microsoft.UI.Xaml.NameScope __nameScope)");
}
else
{
@@ -64,65 +82,75 @@ private void TryWriteApply()
_applyDisposable = new DisposableAction(() =>
{
- blockDisposable.Dispose();
+ if (_applyPrefix != null || !_exposeContext)
+ {
+ _source.Append(_inner.ToString());
+ blockDisposable.Dispose();
+ }
+ else if (_exposeContext)
+ {
+ blockDisposable.Dispose();
+ _onRegisterApplyMethodBody(_inner.ToString());
+ }
+
_source.AppendLineIndented("))");
});
}
}
- public int CurrentLevel => _source.CurrentLevel;
+ public int CurrentLevel => _inner.CurrentLevel;
public void Append(string text)
{
TryWriteApply();
- _source.Append(text);
+ _inner.Append(text);
}
public void AppendLine()
{
TryWriteApply();
- _source.AppendLine();
+ _inner.AppendLine();
}
public void AppendMultiLineIndented(string text)
{
TryWriteApply();
- _source.AppendMultiLineIndented(text);
+ _inner.AppendMultiLineIndented(text);
}
public IDisposable Block(IFormatProvider formatProvider, string pattern, params object[] parameters)
{
TryWriteApply();
- return _source.Block(formatProvider, pattern, parameters);
+ return _inner.Block(formatProvider, pattern, parameters);
}
public IDisposable Block(int count = 1)
{
TryWriteApply();
- return _source.Block(count);
+ return _inner.Block(count);
}
public IDisposable Indent(int count = 1)
{
TryWriteApply();
- return _source.Indent(count);
+ return _inner.Indent(count);
}
public void AppendIndented(string text)
{
TryWriteApply();
- _source.AppendIndented(text);
+ _inner.AppendIndented(text);
}
public void AppendIndented(ReadOnlySpan text)
{
TryWriteApply();
- _source.AppendIndented(text);
+ _inner.AppendIndented(text);
}
public void AppendFormatIndented(IFormatProvider formatProvider, string text, params object[] replacements)
{
TryWriteApply();
- _source.AppendFormatIndented(formatProvider, text, replacements);
+ _inner.AppendFormatIndented(formatProvider, text, replacements);
}
public void Dispose()
@@ -131,7 +159,7 @@ public void Dispose()
_parentDisposable?.Dispose();
}
- public override string ToString() => _source.ToString();
+ public override string ToString() => _inner.ToString();
}
}
diff --git a/src/Uno.UI.RemoteControl.Server.Processors/HotReload/ServerHotReloadProcessor.MetadataUpdate.cs b/src/Uno.UI.RemoteControl.Server.Processors/HotReload/ServerHotReloadProcessor.MetadataUpdate.cs
index 1d4b9ea3bb7c..48f9ac106ad1 100644
--- a/src/Uno.UI.RemoteControl.Server.Processors/HotReload/ServerHotReloadProcessor.MetadataUpdate.cs
+++ b/src/Uno.UI.RemoteControl.Server.Processors/HotReload/ServerHotReloadProcessor.MetadataUpdate.cs
@@ -65,7 +65,7 @@ private void InitializeInner(ConfigureServer configureServer) => _initializeTask
configureServer.ProjectPath,
_reporter,
configureServer.MetadataUpdateCapabilities,
- configureServer.MSBuildProperties,
+ configureServer.MSBuildProperties.Where(kvp => !kvp.Key.StartsWith("MSBuild", StringComparison.OrdinalIgnoreCase)).ToDictionary(),
CancellationToken.None);
ObserveSolutionPaths(result.Item1);
diff --git a/src/Uno.UI.RemoteControl/HotReload/ClientHotReloadProcessor.Common.Status.cs b/src/Uno.UI.RemoteControl/HotReload/ClientHotReloadProcessor.Common.Status.cs
index 16791f6d6d1b..829603ad3e5e 100644
--- a/src/Uno.UI.RemoteControl/HotReload/ClientHotReloadProcessor.Common.Status.cs
+++ b/src/Uno.UI.RemoteControl/HotReload/ClientHotReloadProcessor.Common.Status.cs
@@ -8,6 +8,7 @@
using System.Reflection;
using System.Threading;
using Uno.Diagnostics.UI;
+using Uno.Foundation.Logging;
#if HAS_UNO_WINUI
using Uno.UI.RemoteControl.HotReload.Messages;
@@ -138,7 +139,14 @@ private void NotifyStatusChanged()
var status = BuildStatus();
Current = status;
- owner.StatusChanged?.Invoke(this, status);
+ try
+ {
+ owner.StatusChanged?.Invoke(this, status);
+ }
+ catch (Exception error)
+ {
+ this.Log().Error("Failed to notify the status changed.", error);
+ }
}
private Status BuildStatus()
diff --git a/src/Uno.UI.RemoteControl/HotReload/ClientHotReloadProcessor.PartialReload.cs b/src/Uno.UI.RemoteControl/HotReload/ClientHotReloadProcessor.PartialReload.cs
index b2cd8b1af0c0..1b674d6773c4 100644
--- a/src/Uno.UI.RemoteControl/HotReload/ClientHotReloadProcessor.PartialReload.cs
+++ b/src/Uno.UI.RemoteControl/HotReload/ClientHotReloadProcessor.PartialReload.cs
@@ -29,10 +29,12 @@ private void InitializePartialReload()
var unoRuntimeIdentifier = GetMSBuildProperty("UnoRuntimeIdentifier");
var targetFramework = GetMSBuildProperty("TargetFramework");
var buildingInsideVisualStudio = GetMSBuildProperty("BuildingInsideVisualStudio");
+ var msBuildVersion = GetMSBuildProperty("MSBuildVersion");
_supportsPartialHotReload =
buildingInsideVisualStudio.Equals("true", StringComparison.OrdinalIgnoreCase)
&& _forcedHotReloadMode is null or HotReloadMode.Partial
+ && (Version.TryParse(msBuildVersion, out var v) is false || v is not { Major: >= 17, Minor: >= 12 })
&& (
// As of VS 17.8, when the debugger is attached, mobile targets don't invoke MetadataUpdateHandlers
// and both targets are not providing updated types. We simulate parts of this process
diff --git a/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Given_TextBlock.cs b/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Given_TextBlock.cs
index c87b9915f418..c99eec807d83 100644
--- a/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Given_TextBlock.cs
+++ b/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Given_TextBlock.cs
@@ -121,7 +121,15 @@ public async Task When_Changing_TextBlock_UsingHRClient_NoChanges()
true)
.WithExtendedTimeouts(); // Required for CI
- await hr.UpdateFileAsync(req, ct);
+ try
+ {
+ await hr.UpdateFileAsync(req, ct);
+ }
+ finally
+ {
+ // Make sure to undo to not impact other tests!
+ await hr.UpdateFileAsync(req.Undo(waitForHotReload: false), CancellationToken.None);
+ }
}
// Another version of the test above, but pausing the TypeMapping before calling the file update
diff --git a/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Given_TypeReplacement.cs b/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Given_TypeReplacement.cs
index 68131528f487..1b893f6aa66c 100644
--- a/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Given_TypeReplacement.cs
+++ b/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Given_TypeReplacement.cs
@@ -34,7 +34,6 @@ await HotReloadHelper.UpdateServerFileAndRevert(
var grid = (Grid)page.Content;
var component = (UserControl)grid.Children.Single();
Assert.AreNotEqual(oldComponent, component);
- Assert.IsTrue(component.GetType().Name.Contains("#"));
Assert.AreEqual(1, Grid.GetRow(component));
Assert.AreEqual("Hello tag", component.Tag as string);
Assert.AreEqual(Microsoft.UI.Colors.Orange, ((SolidColorBrush)((Grid)component.Content).Background).Color);
@@ -60,8 +59,6 @@ await HotReloadHelper.UpdateServerFileAndRevert(
{
var component = (UserControl)page.Content;
Assert.AreNotEqual(oldComponent, component);
- Assert.IsTrue(component.GetType().Name.Contains("#"));
-
Assert.IsNotNull(component.GetBindingExpression(FrameworkElement.TagProperty));
page.Tag2 = "Updated tag";
diff --git a/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Pages/HR_Frame_Pages_Page2.xaml b/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Pages/HR_Frame_Pages_Page2.xaml
index ba7171230556..6512ad40c2f8 100644
--- a/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Pages/HR_Frame_Pages_Page2.xaml
+++ b/src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Pages/HR_Frame_Pages_Page2.xaml
@@ -7,7 +7,7 @@
mc:Ignorable="d">
-
diff --git a/src/Uno.UI/Helpers/MarkupHelper.cs b/src/Uno.UI/Helpers/MarkupHelper.cs
index 4f3e060edd0e..4b7a7a3b393c 100644
--- a/src/Uno.UI/Helpers/MarkupHelper.cs
+++ b/src/Uno.UI/Helpers/MarkupHelper.cs
@@ -80,8 +80,8 @@ public static void SetVisualTransitionLazy(VisualTransition target, Action build
target.FromLegacyTemplate = TemplatedParentScope.GetCurrentTemplate() is { IsLegacyTemplate: true };
}
- public static IXamlServiceProvider CreateParserContext(object? target, Type propertyDeclaringType, string propertyName, Type propertyType) =>
- CreateParserContext(target, propertyDeclaringType, propertyName, propertyType, null);
+ public static IXamlServiceProvider CreateParserContext(object? target, Type propertyDeclaringType, string propertyName, Type propertyType)
+ => CreateParserContext(target, propertyDeclaringType, propertyName, propertyType, null);
public static IXamlServiceProvider CreateParserContext(object? target, Type propertyDeclaringType, string propertyName, Type propertyType, object? rootObject)
=> new XamlServiceProviderContext