How do I export a C# function with a `JSValue` argument?
@jasongin 已经在做这个了。
开始于 2025年1月10日。
评估
这个 Issue 还没有评估数据。
描述
As per issue title, I'm trying to export a C# class method using TypeExporter.ExportType, but the method is not exported due to the following check, which explicitly disallows JSValue argument types and causes the method to be skipped:
The method has the following signature:
public async Task<JSValue> sendMessage(JSValue parameters)
The purpose of the C# function is:
- to call
JSON.stringify - parse the result with
System.Text.Json - execute some C# code,
- serialize the result with
System.Text.Json - call
JSON.parseagain to return the result to nodeJS.
(I know, the JSON round-trip could be removed in the future by creating a DTO type, but the JSON data currently has a dynamic structure and needs some work)
Changing the signature to a string and using JSON.stringify in NodeJs is a workaround to make the method appear, but I'd like to pass a JSON object directly.
- 主要语言
- 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
-
go 🏃 testing 🧪
难度 2/5 1-3 小时 新手友好度 78/100
valkey-io/valkey-glide#7239 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
SubtitleEdit/subtitleedit#15462 ·
维护者通常 1 天内回复
-
:watch: Not Triaged
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
comp:instrumentation.aspnetcore
难度 2/5 1-3 小时 新手友好度 72/100
open-telemetry/opentelemetry-dotnet-contrib#5427 ·
维护者通常 1 天内回复
-
enhancement needs-triage pkg:OpenTelemetry
难度 2/5 1-3 小时 新手友好度 68/100
open-telemetry/opentelemetry-dotnet#7851 · 4 条评论 ·
维护者通常 1 天内回复