IDisposable: typings say `dispose()`, dynamic binding exposes `Dispose()`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- csharp, javascript, typescript
Hướng nghiên cứu
Start with the cited generator code in src/NodeApi.Generator/TypeDefinitionsGenerator.cs around lines 1217-1221 and the dynamic exporter in src/NodeApi.DotNetHost/TypeExporter.cs around lines 790-797. Reproduce the issue with the provided net472 dynamic-binding example, then verify that generated typings and runtime method names agree for IDisposable; done means calling the typed method no longer fails.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
With dynamic binding (require("node-api-dotnet/net472") then dotnet.load("MyLib.dll")), a class that implements IDisposable gets dispose(): void in the generated .d.ts, but the object at runtime has Dispose and no dispose. Calling the typed name throws TypeError: x.dispose is not a function. TypeScript accepts the call, and a test mock written from the .d.ts passes, so the mismatch only surfaces in production.
Reproduced with node-api-dotnet 0.9.27 and a net472 host:
const t = dotnet.MyLib.Thing.Create();
Object.getOwnPropertyNames(Object.getPrototypeOf(t));
// [..., "Dispose", "Equals", "GetHashCode", "GetType", "ToString", ...]
typeof t.dispose; // "undefined"
The generator renames the method to match the JS convention: https://github.com/microsoft/node-api-dotnet/blob/958b8c3c04dff5414781a88f069062c6528f7427/src/NodeApi.Generator/TypeDefinitionsGenerator.cs#L1217-L1221
The dynamic exporter registers methods under the .NET name with no equivalent rename: https://github.com/microsoft/node-api-dotnet/blob/958b8c3c04dff5414781a88f069062c6528f7427/src/NodeApi.DotNetHost/TypeExporter.cs#L790-L797
Either name is fine, but the two paths should agree.
- Ngôn ngữ chính
- C#
- Star
- 783
- Fork
- 80
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/node-api-dotnet
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/node-api-dotnet#484 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/node-api-dotnet#481 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
microsoft/node-api-dotnet#486 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
microsoft/node-api-dotnet#483 · 1 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
microsoft/node-api-dotnet#479 ·
Tất cả issue của microsoft/node-api-dotnet
Issue tương tự
-
Money ExploitsĐang mởS: Untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
project-wayfarer/wayfarer-14#1628 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
:watch: Not Triaged dotnet-target-version
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
copilot documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 2 ngày
-
untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
dotnet/dotnet-api-docs#13124 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày