diff --git a/src/Java.Interop.Tools.Generator/Metadata/FixupXmlDocument.cs b/src/Java.Interop.Tools.Generator/Metadata/FixupXmlDocument.cs index 50e459ebe..7202b8af5 100644 --- a/src/Java.Interop.Tools.Generator/Metadata/FixupXmlDocument.cs +++ b/src/Java.Interop.Tools.Generator/Metadata/FixupXmlDocument.cs @@ -153,7 +153,7 @@ public void Apply (ApiXmlDocument apiDocument, string apiLevelString, int produc var matched = false; foreach (var node in nodes) { - node.RemoveAttributes (); + node.Attributes (name).Remove (); matched = true; } diff --git a/tests/generator-Tests/Unit-Tests/FixupXmlDocumentTests.cs b/tests/generator-Tests/Unit-Tests/FixupXmlDocumentTests.cs index 42e849c1d..728b3c2cd 100644 --- a/tests/generator-Tests/Unit-Tests/FixupXmlDocumentTests.cs +++ b/tests/generator-Tests/Unit-Tests/FixupXmlDocumentTests.cs @@ -82,7 +82,19 @@ public void RemoveAttribute () api.ApplyFixupFile (fixup); - Assert.AreEqual ("", api.ApiDocument.ToString (SaveOptions.DisableFormatting).Replace ('\"', '\'')); + Assert.AreEqual ("", api.ApiDocument.ToString (SaveOptions.DisableFormatting).Replace ('\"', '\'')); + } + + [Test] + public void RemoveNotFoundAttribute () + { + // Attribute 'foo' doesn't exist on node + var api = GetXmlApiDocument (); + var fixup = GetFixupXmlDocument (""); + + api.ApplyFixupFile (fixup); + + Assert.AreEqual ("", api.ApiDocument.ToString (SaveOptions.DisableFormatting).Replace ('\"', '\'')); } [Test]