Skip to content
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 Analyser to work with global types #9680

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

dellis1972
Copy link
Contributor

@dellis1972 dellis1972 commented Jan 13, 2025

We are seeing the following error in maui apps.

error DNAA0001: Application class 'MainApplication' does not have an Activation Constructor 'MainApplication(IntPtr handle, JniHandleOwnership transfer)'. 

this is because they are using global::Android.Runtime.JniHandleOwnership rather than Android.Runtime.JniHandleOwnership. This causes our string comparisons to fail to we report a false error message.

Rather than using .ToString() we should switch over to using QualifiedNameSyntax and IdentifierNameSyntax to get the name of the class. This allows us to remove some string comparisons as we can now get the name of the class without the full namespace if it has a global:: prefix.

@dellis1972 dellis1972 marked this pull request as ready for review January 14, 2025 12:01
@dellis1972 dellis1972 requested a review from jonpryor as a code owner January 14, 2025 12:01
@dellis1972 dellis1972 removed the request for review from jonpryor January 14, 2025 13:05
Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good now, I reran some test lanes.

@jonathanpeppers jonathanpeppers merged commit 9f5dc78 into main Jan 14, 2025
58 of 60 checks passed
@jonathanpeppers jonathanpeppers deleted the dev/dellis1972/globalconstructor branch January 14, 2025 21:17
grendello added a commit that referenced this pull request Jan 15, 2025
* main:
  [illink] consolidate & remove hardcoded assembly names (#9662)
  Bump to NuGet/NuGet.Client@aa7eb998 (#9682)
  [Microsoft.Android.Sdk.Analysis] fix global types (#9680)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants