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

Loading…
Cancel
Save