Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log error code from hermes.dll load failure #14236

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "First attempt at logging DLL load failure info",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "none"
}
9 changes: 8 additions & 1 deletion vnext/Shared/HermesRuntimeHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ void NAPI_CDECL removeInspectorPage(int32_t pageId) noexcept;

class HermesFuncResolver : public IFuncResolver {
public:
HermesFuncResolver() : libHandle_(LoadLibraryAsPeerFirst(L"hermes.dll")) {}
HermesFuncResolver() {
libHandle_ = LoadLibraryAsPeerFirst(L"hermes.dll");

// If hermes.dll failed to load, catch the last Win32 error and surface it.
if (libHandle_ == nullptr) {
CRASH_ON_ERROR(GetLastError());
}
}

FuncPtr getFuncPtr(const char *funcName) override {
return reinterpret_cast<FuncPtr>(GetProcAddress(libHandle_, funcName));
Expand Down