diff --git a/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixLegacyResourceDesignerStep.cs b/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixLegacyResourceDesignerStep.cs index 8a88408c42d..1a3cf2d89ec 100644 --- a/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixLegacyResourceDesignerStep.cs +++ b/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixLegacyResourceDesignerStep.cs @@ -68,7 +68,6 @@ protected override void LoadDesigner () return; } lookup = BuildResourceDesignerPropertyLookup (designerType); - return; } internal override bool ProcessAssemblyDesigner (AssemblyDefinition assembly) @@ -114,9 +113,10 @@ Dictionary BuildResourceDesignerPropertyLookup (TypeDe foreach (PropertyDefinition property in definition.Properties) { string key = $"{definition.Name}::{property.Name}"; - if (!output.ContainsKey (key)) { - LogMessage ($" Adding {key}"); - output.Add(key, property.GetMethod); + if (output.ContainsKey (key)) { + LogMessage ($" Found duplicate {key}"); + } else { + output.Add (key, property.GetMethod); } } } @@ -125,6 +125,10 @@ Dictionary BuildResourceDesignerPropertyLookup (TypeDe protected override void FixBody (MethodBody body, TypeDefinition designer) { + // This is expected to be null for the first call, in + if (lookup == null) + LoadDesigner (); + // replace // IL_0068: ldsfld int32 Xamarin.Forms.Platform.Android.Resource/Layout::Toolbar // with diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/LinkAssembliesNoShrink.cs b/src/Xamarin.Android.Build.Tasks/Tasks/LinkAssembliesNoShrink.cs index 5d4c65c8509..b560540e61a 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/LinkAssembliesNoShrink.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/LinkAssembliesNoShrink.cs @@ -67,8 +67,6 @@ public override bool RunTask () var fixAbstractMethodsStep = new FixAbstractMethodsStep (resolver, cache, Log); var addKeepAliveStep = new AddKeepAlivesStep (resolver, cache, Log, UsingAndroidNETSdk); var fixLegacyResourceDesignerStep = new FixLegacyResourceDesignerStep (resolver, cache, Log); - if (UseDesignerAssembly) - fixLegacyResourceDesignerStep.Load (); for (int i = 0; i < SourceFiles.Length; i++) { var source = SourceFiles [i]; var destination = DestinationFiles [i]; @@ -140,10 +138,6 @@ public FixLegacyResourceDesignerStep (DirectoryAssemblyResolver resolver, TypeDe this.logger = logger; } - public void Load () { - LoadDesigner (); - } - public override void LogMessage (string message) { logger.LogDebugMessage ("{0}", message);