[runtime] Use method_getTypeEncoding instead of the deprecated method_getDescription - #25686
Conversation
…_getDescription get_method_description () read a method's Objective-C type-encoding string via method_getDescription (method)->types. method_getDescription is deprecated: the <objc/runtime.h> annotation reads "first deprecated in macOS 11.0 - Use method_getName and method_getTypeEncoding". Since the only field we ever consumed was 'types', method_getTypeEncoding returns exactly that same string and is the non-deprecated, future-proof replacement. Standalone backport of the runtime/trampolines.m change from the Xcode 27 update (dotnet/macios #25665, commit 0dc3ce9), as suggested in code review; it is independent of the Xcode 27 bump itself. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run |
There was a problem hiding this comment.
Pull request overview
This PR updates the runtime trampoline helper that retrieves an Objective-C method’s type encoding to avoid using the deprecated method_getDescription, replacing it with method_getTypeEncoding as recommended by <objc/runtime.h>.
Changes:
- Replace
method_getDescription (method)->typeswithmethod_getTypeEncoding (method)inget_method_description. - Add an in-code comment explaining the deprecation and why the replacement is equivalent for this use case.
|
Azure Pipelines successfully started running 3 pipeline(s). |
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.
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.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #7758b71] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ [PR Build #7758b71] Build passed (Build packages) ✅Pipeline on Agent |
✅ 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 |
✅ [PR Build #7758b71] Build passed (Build macOS tests) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🔥 [CI Build #7758b71] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 1 tests failed, 192 tests passed. Failures❌ introspection tests [attempt 3]1 tests failed, 5 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ cecil: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |

get_method_description () read a method's Objective-C type-encoding string via method_getDescription (method)->types. method_getDescription is deprecated: the <objc/runtime.h> annotation reads "first deprecated in macOS 11.0 - Use method_getName and method_getTypeEncoding". Since the only field we ever consumed was 'types', method_getTypeEncoding returns exactly that same string and is the non-deprecated, future-proof replacement.
Standalone backport of the runtime/trampolines.m change from the Xcode 27 update (dotnet/macios #25665, commit 0dc3ce9), as suggested in code review; it is independent of the Xcode 27 bump itself.