Skip to content

Commit

Permalink
fix: Fix invalid code gen of top resource dictionnaries
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Jan 15, 2025
1 parent 504593d commit 258f84d
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@ public record DiagnosticsResult(string Id);
foreach (var scenarioFolder in Directory.EnumerateDirectories(ScenariosFolder, "*.*", SearchOption.TopDirectoryOnly))
{
var scenarioName = Path.GetFileName(scenarioFolder);
var path = Path.Combine(scenarioFolder, "Scenario.json");
var scenarioConfig = Path.Combine(scenarioFolder, "Scenario.json");

#if DEBUG && false
if (!path.Contains("When_DataTemplate_Root_Remove"))
if (!scenarioName.Contains("When_DataTemplate_Event_Add"))
{
continue;
}
#endif

if (File.Exists(path))
if (File.Exists(scenarioConfig))
{
var scenariosDescriptor = ReadScenarioConfig(path);
var scenariosDescriptor = ReadScenarioConfig(scenarioConfig);

if (scenariosDescriptor is not null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ private void ApplyMethod_3(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPag
}

[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
private partial class SubClasses;
private class __MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPage
{
}
private interface IMainPage_Bindings
{
void Initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private void InitializeComponent()
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
{
return
new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new SubClasses._MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0().Build(__owner)
new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new __MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPage.SC0().Build(__owner)
) .GenericApply(__that, __nameScope, (ApplyMethod_6 ))
;
}
Expand All @@ -116,7 +116,7 @@ private void InitializeComponent()
{
IsParsing = true,
Name = "TheListView",
HeaderTemplate = new global::Microsoft.UI.Xaml.DataTemplate(this, (__owner) => new SubClasses._MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC1().Build(__owner)
HeaderTemplate = new global::Microsoft.UI.Xaml.DataTemplate(this, (__owner) => new __MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPage.SC1().Build(__owner)
) .GenericApply(__that, __nameScope, (ApplyMethod_7 ))
,
// Source 0\MainPage.xaml (Line 40:4)
Expand Down Expand Up @@ -323,13 +323,12 @@ private void ApplyMethod_10(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPa
}
}
[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
private partial class SubClasses;
partial class SubClasses
private class __MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPage
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
public class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0
public class SC0
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
Expand Down Expand Up @@ -400,7 +399,7 @@ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkEle
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)
private void ApplyMethod_17(global::Microsoft.UI.Xaml.Controls.TextBlock __p1, SC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
__p1.SetBinding(
global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
Expand All @@ -413,7 +412,7 @@ private void ApplyMethod_17(global::Microsoft.UI.Xaml.Controls.TextBlock __p1, _
__p1.CreationComplete();
}

private void ApplyMethod_18(global::Microsoft.UI.Xaml.Controls.Button __p1, _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
private void ApplyMethod_18(global::Microsoft.UI.Xaml.Controls.Button __p1, SC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
/* _isTopLevelDictionary:False */
__that._component_0 = __p1;
Expand All @@ -422,22 +421,21 @@ private void ApplyMethod_18(global::Microsoft.UI.Xaml.Controls.Button __p1, _Mai
__p1.CreationComplete();
}

private void ApplyMethod_19(global::Microsoft.UI.Xaml.Controls.StackPanel __p1, _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
private void ApplyMethod_19(global::Microsoft.UI.Xaml.Controls.StackPanel __p1, SC0 __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();
}

[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
private partial class SubClasses;
private class __MainPage_d6cd66944958ced0c513e0a04797b51d_MyProject__ResourcesSC0_TestReproMainPage
{
}
}
}
partial class SubClasses
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
public class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC1
public class SC1
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
Expand Down Expand Up @@ -470,14 +468,16 @@ 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)
private void ApplyMethod_20(global::Microsoft.UI.Xaml.Controls.TextBlock __p1, SC1 __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();
}

[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
private partial class SubClasses;
private class __MainPage_d6cd66944958ced0c513e0a04797b51d_MyProject__ResourcesSC1_TestReproMainPage
{
}
}
}
private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder { get; } = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private void InitializeComponent()
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
{
return
new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new SubClasses._MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0().Build(__owner)
new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new __MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPage.SC0().Build(__owner)
) .GenericApply(__that, __nameScope, (ApplyMethod_6 ))
;
}
Expand Down Expand Up @@ -173,13 +173,12 @@ private void ApplyMethod_9(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPag
}

[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
private partial class SubClasses;
partial class SubClasses
private class __MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPage
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
public class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0
public class SC0
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
Expand Down Expand Up @@ -250,7 +249,7 @@ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkEle
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)
private void ApplyMethod_10(global::Microsoft.UI.Xaml.Controls.TextBlock __p1, SC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
__p1.SetBinding(
global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty,
Expand All @@ -263,7 +262,7 @@ private void ApplyMethod_10(global::Microsoft.UI.Xaml.Controls.TextBlock __p1, _
__p1.CreationComplete();
}

private void ApplyMethod_11(global::Microsoft.UI.Xaml.Controls.Button __p1, _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
private void ApplyMethod_11(global::Microsoft.UI.Xaml.Controls.Button __p1, SC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
{
/* _isTopLevelDictionary:False */
__that._component_0 = __p1;
Expand All @@ -272,14 +271,16 @@ private void ApplyMethod_11(global::Microsoft.UI.Xaml.Controls.Button __p1, _Mai
__p1.CreationComplete();
}

private void ApplyMethod_12(global::Microsoft.UI.Xaml.Controls.StackPanel __p1, _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0 __that, global::Microsoft.UI.Xaml.NameScope __nameScope)
private void ApplyMethod_12(global::Microsoft.UI.Xaml.Controls.StackPanel __p1, SC0 __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();
}

[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
private partial class SubClasses;
private class __MainPage_d6cd66944958ced0c513e0a04797b51d_MyProject__ResourcesSC0_TestReproMainPage
{
}
}
}
private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder { get; } = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ private void ApplyMethod_8(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPag
}

[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
private partial class SubClasses;
private class __MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPage
{
}
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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ private void ApplyMethod_3(global::Microsoft.UI.Xaml.Controls.Page __p1, MainPag
}

[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
private partial class SubClasses;
private class __MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPage
{
}
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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public void InitializeComponent()
}

[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
private partial class SubClasses;
private class __MyDictionary_b7707bcf1e73425b710b6a5d04177088_TestNamespaceTestClass
{
}
}
}
namespace MyProject
Expand Down Expand Up @@ -119,5 +121,7 @@ public ResourceDictionarySingleton__MyDictionary_b7707bcf1e73425b710b6a5d0417708
namespace MyProject.__Resources
{
[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
internal partial class SubClasses;
internal class __MyDictionary_b7707bcf1e73425b710b6a5d04177088_MyDictionaryRD
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,20 @@ public void InitializeComponent()
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
{
return
new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new SubClasses._MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_TestReproMyResourceDictionarySC0().Build(__owner)
new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new __MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_TestReproMyResourceDictionary.SC0().Build(__owner)
) ;
}
)
;
}

[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
private partial class SubClasses;
partial class SubClasses
private class __MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_TestReproMyResourceDictionary
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
public class _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_TestReproMyResourceDictionarySC0
public class SC0
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57 = "ms-appx:///TestProject/";
Expand Down Expand Up @@ -196,7 +195,7 @@ public ResourceDictionarySingleton__MyResourceDictionary_92716e07ff456818f6d4125
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
private object Get_1(object __ResourceOwner_1) =>
new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new __Resources.SubClasses._MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRDSC1().Build(__owner)
new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new __Resources.__MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRD.SC1().Build(__owner)
) ;

private global::Microsoft.UI.Xaml.ResourceDictionary _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_ResourceDictionary;
Expand All @@ -217,7 +216,7 @@ private object Get_1(object __ResourceOwner_1) =>
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 =>
{
return
new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new __Resources.SubClasses._MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRDSC2().Build(__owner)
new global::Microsoft.UI.Xaml.DataTemplate(__ResourceOwner_1, (__owner) => new __Resources.__MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRD.SC2().Build(__owner)
) ;
}
)
Expand All @@ -240,13 +239,12 @@ private object Get_1(object __ResourceOwner_1) =>
namespace MyProject.__Resources
{
[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
internal partial class SubClasses;
partial class SubClasses
internal class __MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRD
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
public class _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRDSC1
public class SC1
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57 = "ms-appx:///TestProject/";
Expand Down Expand Up @@ -337,13 +335,10 @@ private static bool TryGetInstance_xBind_2(global::TestRepro.MyModel ___tctx, ou
return true;
}
}
}
partial class SubClasses
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
public class _MyResourceDictionary_92716e07ff456818f6d4125e055d4d57_MyResourceDictionaryRDSC2
public class SC2
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MyResourceDictionary_92716e07ff456818f6d4125e055d4d57 = "ms-appx:///TestProject/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void InitializeComponent()
{
IsParsing = true,
Name = "inner2",
Template = new global::Microsoft.UI.Xaml.Controls.ControlTemplate(this, (__owner) => new SubClasses._MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0().Build(__owner)
Template = new global::Microsoft.UI.Xaml.Controls.ControlTemplate(this, (__owner) => new __MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPage.SC0().Build(__owner)
) ,
// Source 0\MainPage.xaml (Line 15:5)
}
Expand Down Expand Up @@ -321,13 +321,12 @@ private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkEle
}
}
[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]
private partial class SubClasses;
partial class SubClasses
private class __MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPage
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026")]
[global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2111")]
public class _MainPage_d6cd66944958ced0c513e0a04797b51d_TestReproMainPageSC0
public class SC0
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/";
Expand Down
Loading

0 comments on commit 258f84d

Please sign in to comment.