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
-
0 - Backlog Bug
难度 2/5 1-3 小时 新手友好度 88/100
BrighterCommand/Brighter#4444 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
area:frontend bug FE P3
难度 2/5 1-3 小时 新手友好度 86/100
klasolsson81/jobbliggaren#1915 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
triage
难度 2/5 1-3 小时 新手友好度 76/100
microsoft/vscode-copilotstudio#431 ·
维护者通常 2 天内回复