Windows addon loaders are unreachable and swallow load errors

Abierto
#419 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
54/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
cpp

Línea de trabajo

Empieza en packages/host/cpp/CxxNodeApiHostModule.hpp y AddonLoaders.hpp; después inspecciona el llamador del loader en CxxNodeApiHostModule.cpp y las APIs de logging en Logger.hpp. Confirma el alias del loader específico de la plataforma y sigue las cuatro rutas de fallo de Windows. Se considera terminado cuando Windows selecciona el loader adecuado e informa de los errores de carga o de símbolos capturados en lugar de ignorarlos.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
188
Forks
10
Merge medio
2 d 17 h
PR fusionados (30 d)
3

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de callstackincubator/react-native-node-api

Todos los issues de callstackincubator/react-native-node-api

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.