You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm creating this issue to continue the discussion from #15 (comment)
Attempting to work with JS TypedArrays from C# may result in an error from Electron's flavor of Node:
External buffers are not allowed: Error in CreateExternalArrayBuffer at D:\a\1\s\src\NodeApi\JSValue.cs:264
More information about the limitation is at electron/electron#35801. This appears to be quite a controversial issue, but the Electron team seems to believe the limitation is necessary for security.
As a workaround, node-api-dotnet probably will need to handle the new napi_no_external_buffers_allowed status code and fall back to copying the memory instead of using external buffers. That's very unfortunate since it can have a major performance impact in some scenarios, and doesn't have the same semantics as shared memory.
The text was updated successfully, but these errors were encountered:
jasongin
changed the title
TypedArray / Memory<T> marshalling fails in Electron due to disabled eternal buffers
TypedArray / Memory<T> marshalling fails in Electron due to disabled external buffers
Sep 30, 2024
I think this discussion is very necessary, even if we copy the memory once and convert memory directly to a typed array, theoretically we can also achieve better performance.
I haven't yet grasped the technical details of using the Node API with C#. So I have no idea how to test this!
I'm creating this issue to continue the discussion from #15 (comment)
Attempting to work with JS TypedArrays from C# may result in an error from Electron's flavor of Node:
More information about the limitation is at electron/electron#35801. This appears to be quite a controversial issue, but the Electron team seems to believe the limitation is necessary for security.
As a workaround, node-api-dotnet probably will need to handle the new
napi_no_external_buffers_allowed
status code and fall back to copying the memory instead of using external buffers. That's very unfortunate since it can have a major performance impact in some scenarios, and doesn't have the same semantics as shared memory.The text was updated successfully, but these errors were encountered: