You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[generator] Fix for fixing invalid annotation XML. (dotnet#897)
Fixes: dotnet#883
Due to invalid XML provided in Google's `annotations.zip` file, we
run it through the more forgiving `HtmlAgilityPack` (4073f3e) to
attempt to fix it to valid XML.
However, given this snippet:
<item name="android.accounts.AccountManager android.accounts.AccountManagerFuture<android.os.Bundle> addAccount(java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)">
<annotation name="androidx.annotation.RequiresPermission">
<val name="value" val=""android.permission.MANAGE_ACCOUNTS"" />
<val name="apis" val=""..22"" />
</annotation>
</item>
The invalid unescaped `<` and `>` characters in the `//item/@name`
attribute seem to tell `HtmlAgilityPack` not to expect any attribute
strings to be properly escaped. Thus when it gets to the `//val/@val`
attributes, it treats `"` as unescaped as well, thinking we want
to value to be the literal string `"""`.
When it writes out the valid XML, it realizes it needs to escape the
ampersand, and writes out `&quot;`, which breaks our usage of
these annotations.
The fix is to "unescape" every `"` to a `"` so that it will be
escaped correctly when saved as valid XML.
0 commit comments