Crash when returning a IntPtr when dynamically invoke .NET APIs
還沒有人認領這個 Issue。
評估
研究方向
從 src/NodeApi/JSValue.cs:609 開始,使用所示 Node.js REPL 範例中的 NativeLibrary.GetMainProgramHandle() 重現該失敗。將堆疊追蹤與其他回傳 IntPtr 的 API 進行比較;當這些動態呼叫不再當機並成功回傳結果時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Hi!
When I try to invoke dynamically an API which returns an IntPtr (e.g. GetMainProgramHandle()) the process crashes:
C:\Users\xc3ll>node
Welcome to Node.js v16.15.1.
Type ".help" for more information.
> const test = require('node-api-dotnet');
> handle = test.System.Runtime.InteropServices.NativeLibrary.GetMainProgramHandle()
Microsoft.JavaScript.NodeApi.JSException: Invalid argument: Error in DefineProperties at D:\a\_work\1\s\src\NodeApi\JSValue.cs:609
at REPL72:1:60
at Script.runInThisContext (node:vm:129:12)
at REPLServer.defaultEval (node:repl:566:29)
at bound (node:domain:421:15)
at REPLServer.runBound [as eval] (node:domain:432:12)
at REPLServer.onLine (node:repl:893:10)
at REPLServer.emit (node:events:539:35)
at REPLServer.emit (node:domain:475:12)
at REPLServer.Interface._onLine (node:readline:487:10)
at REPLServer.Interface._line (node:readline:864:8)
at Microsoft.JavaScript.NodeApi.JSValue.<>c__DisplayClass114_0.<DefineProperties>b__0(String _, ReadOnlySpan`1 descriptorsPtr)
at Microsoft.JavaScript.NodeApi.JSValue.ToUnmanagedPropertyDescriptors(String name, IReadOnlyCollection`1 descriptors, UseUnmanagedDescriptors action)
at Microsoft.JavaScript.NodeApi.JSValue.DefineProperties(JSPropertyDescriptor[] descriptors)
at Microsoft.JavaScript.NodeApi.JSError.CreateErrorValueForException(Exception exception, String& message)
at Microsoft.JavaScript.NodeApi.JSError.ThrowError(Exception exception)
at Microsoft.JavaScript.NodeApi.JSValue.InvokeCallback[TDescriptor](napi_env env, napi_callback_info callbackInfo, JSValueScopeType scopeType, Func`2 getCallbackDescriptor)
at Microsoft.JavaScript.NodeApi.JSValue.InvokeJSMethod(napi_env env, napi_callback_info callbackInfo)
I tested it with other functions and the result is the same.
- 主要語言
- C#
- 星號
- 783
- 分支
- 80
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/node-api-dotnet 的其他 Issue
-
難度 1/5 1-3 小時 新手友好度 88/100
microsoft/node-api-dotnet#484 ·
-
難度 2/5 1-3 小時 新手友好度 82/100
microsoft/node-api-dotnet#481 ·
-
難度 5/5 一週以上 新手友好度 35/100
microsoft/node-api-dotnet#486 · 1 則留言 ·
-
難度 5/5 一週以上 新手友好度 35/100
microsoft/node-api-dotnet#483 · 1 則留言 · 1 個 reaction ·
-
難度 4/5 3-5 天 新手友好度 45/100
microsoft/node-api-dotnet#479 ·
查看 microsoft/node-api-dotnet 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 72/100
fluentassertions/fluentassertions#3353 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 65/100
-
難度 2/5 半天 新手友好度 78/100
unoplatform/uno#24769 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
AvaloniaUI/Avalonia#22323 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
microsoft/onnxruntime-genai#2633 ·
維護者通常 1 天內回覆