René's URL Explorer Experiment


Title: feat(runtime): primitive arrays, interop.Array.create, delegates boxed for Object params by triniwiz · Pull Request #41 · NativeScript/windows · GitHub

Open Graph Title: feat(runtime): primitive arrays, interop.Array.create, delegates boxed for Object params by triniwiz · Pull Request #41 · NativeScript/windows

X Title: feat(runtime): primitive arrays, interop.Array.create, delegates boxed for Object params by triniwiz · Pull Request #41 · NativeScript/windows

Description: Arrays Every primitive WinRT array parameter now marshals, on both engines. That covers Int32[], UInt32[], Int16[], UInt16[], Int64[], UInt64[], Single[], Double[], Boolean[], Char16[] and the byte types, and it covers both arrays the callee reads and arrays it fills. Before, only byte[] worked, and a plain JS array for byte[] failed with Unspecified error (HRESULT 0x80004005) (e.g. FileIO.WriteBytesAsync(file, [1, 2, 3])). The call passes (count, pointer). The count is in elements, not bytes. A typed array of the element's kind, an ArrayBuffer or a DataView is passed in place: the callee reads or writes JS memory directly. A typed array of the wrong kind is refused (Float64Array for Int32[]). A plain JS array is copied, converting each element the way the matching typed array would. A plain array is refused for a fill array, since the callee's writes would be lost. ParameterDeclaration::is_fill_array() reads the [out] param attribute: is_out() only means ByRef. interop.Array.create(type, count) returns the matching zero-filled typed array, so an array can be allocated up front: const bytes = interop.Array.create('UInt8', reader.UnconsumedBufferLength); reader.ReadBytes(bytes); const ints = interop.Array.create('Int32', 4); // Int32Array Typings added in typings/nswinrt-helpers.d.ts. Still unsupported: received arrays (out T[], e.g. IPropertyValue.GetInt32Array), array return values, and arrays of strings or objects. Delegates passed as Object UIElement.AddHandler(routedEvent, handler, handledEventsToo) takes its handler as Object and unboxes it with QueryInterface(IReference). We passed the bare delegate, so it failed with E_INVALIDARG, and core falls back to instance events, which never see events a control has already handled. JS delegates (classic JsDelegate and napi NapiDelegate) now embed a small tear-off (delegate_box.rs) that answers IInspectable and IReference. Its get_Value returns the delegate itself, and its IUnknown methods forward to the delegate, so COM identity is preserved. AddHandler and RemoveHandler work. The IID comes from GenericInstanceIdBuilder::ireference_of_delegate. A test checks it against RoGetParameterizedTypeInstanceIID. Note that windows-rs signs delegates as a bare {guid} rather than delegate({guid}), so IReference::::IID from the windows crate doesn't match what WinRT uses. Argument errors When an argument can't be marshaled, the call now reports why instead of a bare E_FAIL (thread-local error::set_argument_error, picked up by format_hresult_message; napi throws a TypeError). For example: Expected an Int32Array, an ArrayBuffer, a plain array or null for parameter type Int32[]. Two interop tests asserted that such errors contain HRESULT; they now also accept these messages. Testing windows-napi npm test: 442/442. New Rust tests: IReference IID against the OS; the delegate box (QI, get_Value identity, refcounts); array element conversion, element counts and view checks. End-to-end on Node with windows-napi, 26/26: Array.create for each type. ReadBytes filling a pre-allocated array, and refusing a plain array. PropertyValue.Create*Array for every element type. WriteBytesAsync with a plain array. TextBox.AddHandler(KeyDownEvent, h, true) and RemoveHandler in a live XamlWindow; on main this throws 0x80070057. The same synchronous checks pass on classic V8 (23/23). cargo test -p runtime --lib: same failures as main (environment and network dependent), plus enum_type_arguments, whose 2 s wait times out under parallel load on some runs and passes alone.

Open Graph Description: Arrays Every primitive WinRT array parameter now marshals, on both engines. That covers Int32[], UInt32[], Int16[], UInt16[], Int64[], UInt64[], Single[], Double[], Boolean[], Char16[] and the byte...

X Description: Arrays Every primitive WinRT array parameter now marshals, on both engines. That covers Int32[], UInt32[], Int16[], UInt16[], Int64[], UInt64[], Single[], Double[], Boolean[], Char16[] and the byte...

Opengraph URL: https://github.com/NativeScript/windows/pull/41

X: @github

direct link

Domain: github.com

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/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:aa0b7474-0bf6-4b67-03c8-8413312311bc
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8CE6:21BD98:170CB55:1D2E71D:6B017418
html-safe-nonceb1c7d7d220c337a939b108dec1dfe53add733e362cd0ba84c49bc4987f2fd4aa
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Q0U2OjIxQkQ5ODoxNzBDQjU1OjFEMkU3MUQ6NkIwMTc0MTgiLCJ2aXNpdG9yX2lkIjoiMzk3MDg1MzU2MDgwNzE1ODgwOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacbac555fa3287679ee1118bbfabe6e31c083889eaab5b9aa756c7d0e147e9daa5
hovercard-subject-tagpull_request:5184341303
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/NativeScript/windows/pull/41/files
twitter:imagehttps://avatars.githubusercontent.com/u/6695919?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/6695919?s=400&v=4
og:image:altArrays Every primitive WinRT array parameter now marshals, on both engines. That covers Int32[], UInt32[], Int16[], UInt16[], Int64[], UInt64[], Single[], Double[], Boolean[], Char16[] and the byte...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/NativeScript/windows git https://github.com/NativeScript/windows.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id373653886
octolytics-dimension-repository_nwoNativeScript/windows
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id373653886
octolytics-dimension-repository_network_root_nwoNativeScript/windows
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
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

Links:

Skip to contenthttps://github.com/NativeScript/windows/pull/41/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fwindows%2Fpull%2F41%2Ffiles
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%2Fwindows%2Fpull%2F41%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=NativeScript%2Fwindows
Reloadhttps://github.com/NativeScript/windows/pull/41/files
Reloadhttps://github.com/NativeScript/windows/pull/41/files
Reloadhttps://github.com/NativeScript/windows/pull/41/files
NativeScripthttps://github.com/NativeScript
windowshttps://github.com/NativeScript/windows
Codehttps://github.com/NativeScript/windows
Issueshttps://github.com/NativeScript/windows/issues
Pull requestshttps://github.com/NativeScript/windows/pulls
Actionshttps://github.com/NativeScript/windows/actions
Projectshttps://github.com/NativeScript/windows/projects
Security and qualityhttps://github.com/NativeScript/windows/security
Insightshttps://github.com/NativeScript/windows/insights
Sign up for GitHub https://github.com/signup?return_to=%2FNativeScript%2Fwindows%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FNativeScript%2Fwindows%2Fissues%2Fnew%2Fchoose
triniwizhttps://github.com/triniwiz
mainhttps://github.com/NativeScript/windows/tree/main
feat/winrt-arrays-delegate-boxinghttps://github.com/NativeScript/windows/tree/feat/winrt-arrays-delegate-boxing
Conversation 1 https://github.com/NativeScript/windows/pull/41
Commits 1 https://github.com/NativeScript/windows/pull/41/commits
Checks 3 https://github.com/NativeScript/windows/pull/41/checks
Files changed https://github.com/NativeScript/windows/pull/41/files
Please reload this pagehttps://github.com/NativeScript/windows/pull/41/files
feat(runtime): primitive arrays, interop.Array.create, delegates boxed for Object params https://github.com/NativeScript/windows/pull/41/files#top
Show all changes 1 commit https://github.com/NativeScript/windows/pull/41/files
a338cd8 feat(runtime): primitive arrays, interop.Array.create, boxed delegates triniwiz Nov 6, 2026 https://github.com/NativeScript/windows/pull/41/commits/a338cd87ebd5b0b9b4ab7659fd6f4965d14696a5
Clear filters https://github.com/NativeScript/windows/pull/41/files
Please reload this pagehttps://github.com/NativeScript/windows/pull/41/files
Please reload this pagehttps://github.com/NativeScript/windows/pull/41/files
parameter_declaration.rs https://github.com/NativeScript/windows/pull/41/files#diff-ece6776c1dc39b10172191a64e8c622b0073e0a77e9181901d7a2980f05c4aa9
generic_instance_id_builder.rs https://github.com/NativeScript/windows/pull/41/files#diff-792ba78ec165915a6ec21226335a98eef62d999f4adf6af15aad61060835d605
delegate_box.rs https://github.com/NativeScript/windows/pull/41/files#diff-d35062237bef985198e2f4b6044333308a5e2b9206343382ee1e22718e1ab040
error.rs https://github.com/NativeScript/windows/pull/41/files#diff-8d75d3df3c6ee9c0e43aa14dcee88ddde06b9e00aabddbef6903a696baf0990e
global_fns.rs https://github.com/NativeScript/windows/pull/41/files#diff-41874e2589e6177e724b0b19cd7803dca1f32990ebfabb633334a7c8fe453944
helpers.rs https://github.com/NativeScript/windows/pull/41/files#diff-b808d86633f8a3ca7923bd79eb98c11bc3f0828e00cf7c61e53929da22c29646
interop_test.rs https://github.com/NativeScript/windows/pull/41/files#diff-588bd4f2448bad955418079aca65126a36007370b7f02aa853cef200f0285e8b
interop_array.js https://github.com/NativeScript/windows/pull/41/files#diff-77e9df3a48fc049405c2e916905a318a1c2ee2df6f521f6b21e9d7bcd3d7c6b3
lib.rs https://github.com/NativeScript/windows/pull/41/files#diff-0ec06ea58bd455f09ce6b3bb4c2c1c0d37bda51c1e1be2151c560c9c973959ec
method_call.rs https://github.com/NativeScript/windows/pull/41/files#diff-d4b5f479d079a3be6b69b2f97b43385a30a402a0a07b0e55d710e1889a5037b7
delegate.rs https://github.com/NativeScript/windows/pull/41/files#diff-ab31e475e7ff4a6f331cd32d971184b5fdad29cd82f8e49ccfe50588d382cb3e
interop.rs https://github.com/NativeScript/windows/pull/41/files#diff-376b4e9cde9060ae6494bece0bdda1e165bb49d6d2ed77a00c1743745037a331
invoke.rs https://github.com/NativeScript/windows/pull/41/files#diff-a71b6d3125c86a3f68d6b2bec8999f8cb26b0a9d8cd09416ab3cc6157894863b
value.rs https://github.com/NativeScript/windows/pull/41/files#diff-afbb6e4c6b2910a255031ed59d437805332e450e97f8741c88a79a31ee633ce9
property_call.rs https://github.com/NativeScript/windows/pull/41/files#diff-ab9dad0dc50de9a4d6e7e30abb9268e2699ff54930bae109f36f873815b196ef
value.rs https://github.com/NativeScript/windows/pull/41/files#diff-bfca47ce3812b16f4018e8b00fe715af33c5d5c2eb0e556df3de3bc09ef604a6
nswinrt-helpers.d.ts https://github.com/NativeScript/windows/pull/41/files#diff-12dfb999ac845b06c0cee34ad31fd7f8f8516c7994eeac8d70aa44e4d3043668
metadata/src/declarations/parameter_declaration.rshttps://github.com/NativeScript/windows/pull/41/files#diff-ece6776c1dc39b10172191a64e8c622b0073e0a77e9181901d7a2980f05c4aa9
View file https://github.com/NativeScript/windows/blob/a338cd87ebd5b0b9b4ab7659fd6f4965d14696a5/metadata/src/declarations/parameter_declaration.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/windows/pull/41/{{ revealButtonHref }}
https://github.com/NativeScript/windows/pull/41/files#diff-ece6776c1dc39b10172191a64e8c622b0073e0a77e9181901d7a2980f05c4aa9
https://github.com/NativeScript/windows/pull/41/files#diff-ece6776c1dc39b10172191a64e8c622b0073e0a77e9181901d7a2980f05c4aa9
https://github.com/NativeScript/windows/pull/41/files#diff-ece6776c1dc39b10172191a64e8c622b0073e0a77e9181901d7a2980f05c4aa9
https://github.com/NativeScript/windows/pull/41/files#diff-ece6776c1dc39b10172191a64e8c622b0073e0a77e9181901d7a2980f05c4aa9
https://github.com/NativeScript/windows/pull/41/files#diff-ece6776c1dc39b10172191a64e8c622b0073e0a77e9181901d7a2980f05c4aa9
metadata/src/generic_instance_id_builder.rshttps://github.com/NativeScript/windows/pull/41/files#diff-792ba78ec165915a6ec21226335a98eef62d999f4adf6af15aad61060835d605
View file https://github.com/NativeScript/windows/blob/a338cd87ebd5b0b9b4ab7659fd6f4965d14696a5/metadata/src/generic_instance_id_builder.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/windows/pull/41/{{ revealButtonHref }}
https://github.com/NativeScript/windows/pull/41/files#diff-792ba78ec165915a6ec21226335a98eef62d999f4adf6af15aad61060835d605
https://github.com/NativeScript/windows/pull/41/files#diff-792ba78ec165915a6ec21226335a98eef62d999f4adf6af15aad61060835d605
https://github.com/NativeScript/windows/pull/41/files#diff-792ba78ec165915a6ec21226335a98eef62d999f4adf6af15aad61060835d605
runtime/src/delegate_box.rshttps://github.com/NativeScript/windows/pull/41/files#diff-d35062237bef985198e2f4b6044333308a5e2b9206343382ee1e22718e1ab040
View file https://github.com/NativeScript/windows/blob/a338cd87ebd5b0b9b4ab7659fd6f4965d14696a5/runtime/src/delegate_box.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/windows/pull/41/{{ revealButtonHref }}
runtime/src/error.rshttps://github.com/NativeScript/windows/pull/41/files#diff-8d75d3df3c6ee9c0e43aa14dcee88ddde06b9e00aabddbef6903a696baf0990e
View file https://github.com/NativeScript/windows/blob/a338cd87ebd5b0b9b4ab7659fd6f4965d14696a5/runtime/src/error.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/windows/pull/41/{{ revealButtonHref }}
https://github.com/NativeScript/windows/pull/41/files#diff-8d75d3df3c6ee9c0e43aa14dcee88ddde06b9e00aabddbef6903a696baf0990e
https://github.com/NativeScript/windows/pull/41/files#diff-8d75d3df3c6ee9c0e43aa14dcee88ddde06b9e00aabddbef6903a696baf0990e
runtime/src/global_fns.rshttps://github.com/NativeScript/windows/pull/41/files#diff-41874e2589e6177e724b0b19cd7803dca1f32990ebfabb633334a7c8fe453944
View file https://github.com/NativeScript/windows/blob/a338cd87ebd5b0b9b4ab7659fd6f4965d14696a5/runtime/src/global_fns.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/windows/pull/41/{{ revealButtonHref }}
https://github.com/NativeScript/windows/pull/41/files#diff-41874e2589e6177e724b0b19cd7803dca1f32990ebfabb633334a7c8fe453944
https://github.com/NativeScript/windows/pull/41/files#diff-41874e2589e6177e724b0b19cd7803dca1f32990ebfabb633334a7c8fe453944
Please reload this pagehttps://github.com/NativeScript/windows/pull/41/files
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.