René's URL Explorer Experiment


Title: interop.FunctionReference function passed as a block, then as a function pointer, asserts · Issue #503 · NativeScript/ios · GitHub

Open Graph Title: interop.FunctionReference function passed as a block, then as a function pointer, asserts · Issue #503 · NativeScript/ios

X Title: interop.FunctionReference function passed as a block, then as a function pointer, asserts · Issue #503 · NativeScript/ios

Description: Summary A function wrapped with interop.FunctionReference and then passed to a native API as a block loses its FunctionReference identity. A later attempt to pass it as a function pointer then hits tns::Assert(false) in Interop::SetFFIPa...

Open Graph Description: Summary A function wrapped with interop.FunctionReference and then passed to a native API as a block loses its FunctionReference identity. A later attempt to pass it as a function pointer then hits...

X Description: Summary A function wrapped with interop.FunctionReference and then passed to a native API as a block loses its FunctionReference identity. A later attempt to pass it as a function pointer then hits...

Opengraph URL: https://github.com/NativeScript/ios/issues/503

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"interop.FunctionReference function passed as a block, then as a function pointer, asserts","articleBody":"## Summary\n\nA function wrapped with `interop.FunctionReference` and then passed to a native API as a **block** loses its FunctionReference identity. A later attempt to pass it as a **function pointer** then hits `tns::Assert(false)` in `Interop::SetFFIParams`, which crashes the app.\n\n## Repro\n\n```js\nconst fn = function () {};\nconst ref = new interop.FunctionReference(fn); // returns fn itself\n\n// Any API taking a block, e.g.:\nNSOperationQueue.mainQueue.addOperationWithBlock(ref);\n\n// Any API taking a C function pointer, e.g. a struct field or a C function parameter\n// typed as a function pointer:\nsomeFunctionTakingAFunctionPointer(ref); // -> tns::Assert(false)\n```\n\n## Cause\n\nBoth wrapper kinds live in the same per-object slot (`tns::SetValue` / `tns::GetValue`):\n\n- `FunctionReference`'s constructor stores a `FunctionReferenceWrapper` on `fn` and registers `fn` with `ObjectManager` (`FunctionReference.cpp`).\n- The block branch of `Interop::SetFFIParams` doesn't recognise a `FunctionReferenceWrapper` as a cached block. It builds a `JSBlock` and overwrites the slot with its `BlockWrapper`. `tns::SetValue` doesn't free the previous wrapper, so the `FunctionReferenceWrapper` leaks, along with the trampoline it may have cached.\n- The function-pointer branch accepts only `Pointer`, `AnonymousFunction` and `FunctionReference` wrappers. With a `BlockWrapper` in the slot it falls through to `tns::Assert(false, isolate)` (`NativeScript/runtime/Interop.mm`, function-pointer branch of `SetFFIParams`).\n\nIn the opposite order (block first, then `new interop.FunctionReference(fn)`), the constructor overwrites the block's wrapper. Every later block marshal of `fn` then builds a new block instead of reusing the cached one, and the next one overwrites the `FunctionReferenceWrapper` again.\n\n## Expected\n\nOne function can be used both as a block and as a function pointer. Possible directions:\n- keep the block cache and the FunctionReference state in separate slots;\n- let the block path recognise a `FunctionReferenceWrapper` and keep the block alongside it.\n\nEither way, neither marshal should evict the other's wrapper, and the function-pointer path should never assert on a wrapper type it can explain to the user. At minimum it should throw a JS error instead.\n\n## Context\n\nFound while reviewing #500, which makes JS block wrappers owned by their `JSBlock`. The worker test added there (`blockFunctionReferenceWorker.js`) relies on the current overwrite behaviour to reach the teardown path.\n","author":{"url":"https://github.com/edusperoni","@type":"Person","name":"edusperoni"},"datePublished":"2026-10-09T18:25:54Z","url":"https://github.com/NativeScript/ios/issues/503"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:af9013d2-d3ff-1ee6-1035-1adf3eb6da8b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDA2C:3A347:17FB212:1FB7DCD:6B013C74
html-safe-nonce961cbed2cd8ae39b002334b20362dfed0ddced3d7c3e0ba69d12c5f1e74ef046
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTJDOjNBMzQ3OjE3RkIyMTI6MUZCN0RDRDo2QjAxM0M3NCIsInZpc2l0b3JfaWQiOiI3MzY1NjEwNDU2MTg4MjcxNzMyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac168ee65322b32e7f5977be11fffd872dbdf995fa0c59f7095c95e0d1bcaba2b6
hovercard-subject-tagissue:5782792559
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/ios/503/issue_layout
twitter:imagehttps://opengraph.githubassets.com/067c4746f4fc3eaac47d16bf8dd829b1e78ae9918b94f70e8699436ede9e9f8a/NativeScript/ios/issues/503
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/067c4746f4fc3eaac47d16bf8dd829b1e78ae9918b94f70e8699436ede9e9f8a/NativeScript/ios/issues/503
og:image:altSummary A function wrapped with interop.FunctionReference and then passed to a native API as a block loses its FunctionReference identity. A later attempt to pass it as a function pointer then hits...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameedusperoni
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/NativeScript/ios git https://github.com/NativeScript/ios.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id172934359
octolytics-dimension-repository_nwoNativeScript/ios
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id172934359
octolytics-dimension-repository_network_root_nwoNativeScript/ios
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/NativeScript/ios/issues/503#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fios%2Fissues%2F503
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fios%2Fissues%2F503
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=NativeScript%2Fios
Reloadhttps://github.com/NativeScript/ios/issues/503
Reloadhttps://github.com/NativeScript/ios/issues/503
Reloadhttps://github.com/NativeScript/ios/issues/503
NativeScripthttps://github.com/NativeScript
ioshttps://github.com/NativeScript/ios
Codehttps://github.com/NativeScript/ios
Issues56 (56)https://github.com/NativeScript/ios/issues
Pull requests42 (42)https://github.com/NativeScript/ios/pulls
Actionshttps://github.com/NativeScript/ios/actions
Projectshttps://github.com/NativeScript/ios/projects
Security and qualityhttps://github.com/NativeScript/ios/security
Insightshttps://github.com/NativeScript/ios/insights
https://github.com/NativeScript/ios
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/ios/issues/503
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/ios/issues/503
#504https://github.com/NativeScript/ios/pull/504
interop.FunctionReference function passed as a block, then as a function pointer, assertshttps://github.com/NativeScript/ios/issues/503#top
#504https://github.com/NativeScript/ios/pull/504
https://github.com/edusperoni
edusperonihttps://github.com/edusperoni
on Oct 9, 2026https://github.com/NativeScript/ios/issues/503#issue-5782792559
#500https://github.com/NativeScript/ios/pull/500
Sign up for freehttps://github.com/signup?return_to=https://github.com/NativeScript/ios/issues/503
Sign in to commenthttps://github.com/login?return_to=https://github.com/NativeScript/ios/issues/503
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.