-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue with Resource Parser #8091
Conversation
11bd218
to
6fe7f23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good if CI ends up green. 👍
@@ -63,6 +64,7 @@ public class RtxtParser { | |||
static readonly char[] EmptyChar = new char [] { ' ' }; | |||
static readonly char[] CurlyBracketsChar = new char [] { '{', '}' }; | |||
static readonly char[] CommaChar = new char [] { ',' }; | |||
static readonly Regex ValidChars = new Regex (@"([^a-f0-9x, \{\}])+", RegexOptions.Compiled | RegexOptions.IgnoreCase); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point, should we start using the faster Regex source generator?
https://learn.microsoft.com/dotnet/standard/base-types/regular-expression-source-generators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. We can do that in one pass I think. Maybe not in this PR though :D
a69c1ee
to
7980726
Compare
8ef1674
to
ef2b484
Compare
* main: [ci] Shut down dotnet processes before retrying failed unit tests. (dotnet#8107) Bump to dotnet/installer@18dc2cf1 8.0.100-preview.6.23305.2 [Xamarin.Android.Build.Tasks] Ignore non-Android XML resources (dotnet#8091) [build] Ignore CA1305 in more projects (dotnet#8110)
We have seen reports of the following error/warning when building Maui or Android projects.
Our initial thoughts were that we were trying to parse an empty
R.txt
file. However this did not seem to pan out.Further investigation found this line in an
R.txt
fileThis is very odd, since
id
values should NOT contain spaces.It turns out this is caused by the following code
This is from
com.google.android.material.material.aar
. It turns out that you can have additional namespaces in the resource xml files.aapt2
ignores these additional namespaces but OUR managed parser does not.As a result the
id="maximum number"
attribute gets picked up as a validid
value.The fix in this case is to check if the containing element has a namespace. If it does then make sure it is the android resource namespace. ALL other namespaces will be ignored. We also added a new Regex to check for invalid characters just incase the Namespace check allows some entires though.