Browse Source

Fix #1599: Ignore duplicate keys in resource dictionary.

pull/1633/head
Siegfried Pammer 6 years ago
parent
commit
c9d2e4f728
  1. 18
      ILSpy.BamlDecompiler/Rewrite/MarkupExtensionRewritePass.cs

18
ILSpy.BamlDecompiler/Rewrite/MarkupExtensionRewritePass.cs

@ -77,14 +77,16 @@ namespace ILSpy.BamlDecompiler.Rewrite {
var attrName = elem.Name; var attrName = elem.Name;
if (attrName != key) if (attrName != key)
attrName = property.ToXName(ctx, parent, property.IsAttachedTo(type)); attrName = property.ToXName(ctx, parent, property.IsAttachedTo(type));
var attr = new XAttribute(attrName, extValue); if (!parent.Attributes(attrName).Any()) {
var list = new List<XAttribute>(parent.Attributes()); var attr = new XAttribute(attrName, extValue);
if (attrName == key) var list = new List<XAttribute>(parent.Attributes());
list.Insert(0, attr); if (attrName == key)
else list.Insert(0, attr);
list.Add(attr); else
parent.RemoveAttributes(); list.Add(attr);
parent.ReplaceAttributes(list); parent.RemoveAttributes();
parent.ReplaceAttributes(list);
}
elem.Remove(); elem.Remove();
return true; return true;

Loading…
Cancel
Save