Closed james-hu closed 8 months ago
A .NET Memory<byte>
should get converted to JS UInt8Array
, in both typedefs and runtime.
But there might be some other reason you're unable to call the method.
Object.keys(obj)
Can you check what properties are defined on the JS object? Object.keys(obj)
Do you see other expected methods/properties on the object?
Memory<T>
. I tried changing the return type from Memory<byte>
to string or byte[], both made that method available to Node.js. How are you getting the JS instance of the class?
BTW, currently I use base64 encoded string to pass binary data from .NET to Node.js as a workaround.
I confirmed in #220 with more testing that Memory<byte>
is working as expected. So there is likely some other problem here.
the JS class instance does not have such function on it
This sounds like there was some other problem with the method that is unrelated to the fact that it returns Memory<byte>
. If you want to troubleshoot further, it might help to share relevant snippets of the code.
I'm closing this for now since the originally reported problem is not reproducible. But feel free to re-open with more information if you're still having this problem.
I tried to use
Memory<byte>
as return type of a method on dotnet side and call the method from Javascript. However, although the generated .d.ts file contains the method signature, the Javascript code is not able to call that method. The error message says the object does not have such method/property/function. I tried to change the return type to string or byte[] then the method could be called from Javascript.Is
Memory<byte>
supported?BTW, I suspected marshaller code needs to be generated and utlised, however, I couldn't find any generated file. I've created another issue for that: #207