Skip to content

Commit 5adb4d4

Browse files
authored
[generator] Prevent BG8A08 warning when using ns-replace (#1136)
Context: 0c90cf5 Context: be2acbc As part of the Nullable Reference Type work in be2acbc, we added a BG8A08 warning when the `//*/@path` attribute of a "metadata" element is not provided. However, metadata files can also contain `<ns-replace/>` elements, which do not have a `@path` attribute, and thus erroneously trigger this warning: generated\msbuild-metadata.xml(3,4): warning BG8A08: Metadata.xml element '<ns-replace source="com.google.androidx" replacement="Xamarin.AndroidX" />' is missing the 'path' attribute. Skip running any of the standard "metadata" logic when we hit a `<ns-replace>` element, as they are handled elsewhere.
1 parent 62efc09 commit 5adb4d4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Java.Interop.Tools.Generator/Metadata/FixupXmlDocument.cs

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public void Apply (ApiXmlDocument apiDocument, string apiLevelString, int produc
4141
if (!ShouldApply (metaitem, apiDocument))
4242
continue;
4343

44+
// Namespace replacements are handled elsewhere
45+
if (metaitem.Name.LocalName == "ns-replace")
46+
continue;
47+
4448
var path = metaitem.XGetAttribute ("path");
4549

4650
if (path != prev_path)

0 commit comments

Comments
 (0)