Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Windows addon loaders are unreachable and swallow load errors

未关闭
#419 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
54/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
cpp

调研方向

从 packages/host/cpp/CxxNodeApiHostModule.hpp 和 AddonLoaders.hpp 开始,然后检查 CxxNodeApiHostModule.cpp 中的 loader 调用方以及 Logger.hpp 中的 logging API。确认平台特定的 loader 别名,并跟踪 Windows 的四条失败路径。完成的标准是 Windows 选择适当的 loader,并报告捕获到的加载错误或符号错误,而不是将其吞掉。

由索引模型根据 Issue 内容生成。

描述

C++ Host 🏡

Grouping the FIXME/HACK in CxxNodeApiHostModule.hpp with the four TODOs in AddonLoaders.hpp. Both halves of the Windows story are incomplete, and the first makes the second unobservable.

The loader policy is hardcoded to POSIX

https://github.com/callstackincubator/react-native-node-api/blob/29a527d87fa8cb965b0048b1b4c1cff2b0eab281/packages/host/cpp/CxxNodeApiHostModule.hpp#L45-L46

Win32Loader and WinRTLoader exist in AddonLoaders.hpp and are compiled behind #if defined(_WIN32), but nothing ever selects them — LoaderPolicy is unconditionally PosixLoader. The alias should be chosen by platform (_WIN32Win32Loader, with WinRT distinguished by the appropriate API-family macro, POSIX otherwise), which is a compile-time #if rather than a design question.

The Windows loaders discard the reason for every failure

All four failure paths detect the error and then do nothing with it:

https://github.com/callstackincubator/react-native-node-api/blob/29a527d87fa8cb965b0048b1b4c1cff2b0eab281/packages/host/cpp/AddonLoaders.hpp#L52-L57

https://github.com/callstackincubator/react-native-node-api/blob/29a527d87fa8cb965b0048b1b4c1cff2b0eab281/packages/host/cpp/AddonLoaders.hpp#L63-L68

https://github.com/callstackincubator/react-native-node-api/blob/29a527d87fa8cb965b0048b1b4c1cff2b0eab281/packages/host/cpp/AddonLoaders.hpp#L84-L89

https://github.com/callstackincubator/react-native-node-api/blob/29a527d87fa8cb965b0048b1b4c1cff2b0eab281/packages/host/cpp/AddonLoaders.hpp#L95-L100

LoadLibrary/LoadPackagedLibrary/GetProcAddress all return null and leave the reason in GetLastError(). Returning null without capturing it means the caller in CxxNodeApiHostModule.cpp can only report "Failed to load library" — the distinction between "file not found", "a transitive dependency is missing" and "wrong architecture" is lost, and those are precisely the three things a developer needs to tell apart. PosixLoader has the same shape of gap but at least has dlerror() available; the commented-out NSLog there suggests it was once wired up.

Suggested minimum: format the DWORD via FormatMessageA and route it through log_error/log_debug from Logger.hpp, matching how the POSIX path should report dlerror().

Both were listed in the original permalinks on #30. Relevant to #305 (Windows test app on CI) — without a Windows test app these paths stay unexercised whichever way they are fixed.

主要语言
TypeScript
星标
188
派生
10
平均合并
2 天 17 小时
30 天内合并 PR
3

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstackincubator/react-native-node-api 的其他 Issue

查看 callstackincubator/react-native-node-api 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。