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 2f8569f515a..ae4473d6cd1 100644 --- a/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixLegacyResourceDesignerStep.cs +++ b/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixLegacyResourceDesignerStep.cs @@ -30,6 +30,7 @@ public class FixLegacyResourceDesignerStep : LinkDesignerBase AssemblyDefinition designerAssembly = null; TypeDefinition designerType = null; Dictionary lookup; + Dictionary lookupCaseInsensitive; protected override void EndProcess () { @@ -61,7 +62,7 @@ protected override void LoadDesigner () LogMessage ($" Did not find {DesignerAssemblyNamespace}.Resource type. It was probably linked out."); return; } - lookup = BuildResourceDesignerPropertyLookup (designerType); + lookup = BuildResourceDesignerPropertyLookup (designerType, out lookupCaseInsensitive); } finally { designerLoaded = true; } @@ -105,10 +106,11 @@ internal override bool ProcessAssemblyDesigner (AssemblyDefinition assembly) return true; } - Dictionary BuildResourceDesignerPropertyLookup (TypeDefinition type) + Dictionary BuildResourceDesignerPropertyLookup (TypeDefinition type, out Dictionary caseInsensitiveLookup) { LogMessage ($" Building Designer Lookups for {type.FullName}"); var output = new Dictionary (StringComparer.Ordinal); + caseInsensitiveLookup = new Dictionary (StringComparer.OrdinalIgnoreCase); foreach (TypeDefinition definition in type.NestedTypes) { foreach (PropertyDefinition property in definition.Properties) @@ -117,7 +119,9 @@ Dictionary BuildResourceDesignerPropertyLookup (TypeDe if (output.ContainsKey (key)) { LogMessage ($" Found duplicate {key}"); } else { + LogMessage ($" Adding {key}"); output.Add (key, property.GetMethod); + caseInsensitiveLookup [key] = property.GetMethod; } } } @@ -153,7 +157,12 @@ protected override void FixBody (MethodBody body, TypeDefinition designer) if (idx >= 0) { string key = line.Substring (idx + designerFullName.Length); LogMessage ($"Looking for {key}."); - if (lookup.TryGetValue (key, out MethodDefinition method)) { + var found = lookup.TryGetValue (key, out MethodDefinition method); + if (!found) { + LogMessage ($"DEBUG! Failed to find {key}! Trying case insensitive lookup."); + found = lookupCaseInsensitive.TryGetValue (key, out method); + } + if (found) { var importedMethod = designer.Module.ImportReference (method); var newIn = Instruction.Create (OpCodes.Call, importedMethod); instructions.Add (i, newIn);