[xtro-sharpie] Fix ProtocolAttribute native name lookup - #26498
Conversation
Helpers.GetName(TypeDefinition) only checked ProtocolAttribute's constructor arguments for the native protocol name, but [Protocol]'s Name is set via a named property, not a constructor argument (e.g. [Protocol (Name = "NFCISO15693Tag")]). This caused the lookup to fall back to the managed type name (NFCIso15693Tag), which doesn't match the native declaration's casing (NFCISO15693Tag), so NullabilityCheck's GetMethod lookup silently failed and no !missing-null-allowed! diagnostic was ever produced for members of such protocols. This is why NFCISO15693Tag.stayQuietWithCompletionHandler:'s missing nullable annotation on its block parameter was never caught, even though the sibling ConnectToTag/ConnectTo methods (bound with non-property-based native names) were correctly flagged. Fix GetName to also check the attribute's properties for 'Name', and add the now-detected StayQuiet diagnostic to the CoreNFC .ignore files. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes xtro-sharpie’s native name lookup for protocol types when the Objective-C protocol name is provided via ProtocolAttribute.Name, so the nullability analysis can correctly match native declarations and emit diagnostics for protocol members (e.g., CoreNFC StayQuiet).
Changes:
- Update
Helpers.GetName (TypeDefinition?)to also readProtocolAttribute’s namedNameproperty when no constructor argument is present. - Record newly-detected CoreNFC block-parameter nullability diagnostics in both iOS and Mac Catalyst CoreNFC ignore lists.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/xtro-sharpie/xtro-sharpie/Helpers.cs | Extends protocol native-name resolution to consider ProtocolAttribute.Name. |
| tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-CoreNFC.ignore | Adds the newly detected INFCIso15693Tag.StayQuiet nullability diagnostic. |
| tests/xtro-sharpie/api-annotations-dotnet/iOS-CoreNFC.ignore | Adds the newly detected INFCIso15693Tag.StayQuiet nullability diagnostic. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
🚀 [CI Build #27ed9c2] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 264 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
Fixes the xtro-sharpie nullability check for members of protocols whose native name is supplied through
ProtocolAttribute.Name.Helpers.GetName(TypeDefinition)previously only inspected constructor arguments and fell back to the managed type name. For many types, that prevented matching native declarations and caused a number of diagnostics to go unreported.🤖 Pull request created by Copilot