Gen GUI app error "Failed to load DLL file, reason code 126"
search cancel

Gen GUI app error "Failed to load DLL file, reason code 126"

book

Article ID: 91733

calendar_today

Updated On:

Products

Gen Gen - Run Time Distributed

Issue/Introduction

Generated a Gen GUI application and deployed it to a user workstation.  When the user executes the application, the following message is returned.:
Failed to load DLL file, reason code 126

Environment

Release: Any
Component: Gen Runtime, GUI 

Cause

The error is not specific to a Gen application.
In general, reason code 126 "Failed to load DLL <module>" means "The specified module could not be found": https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
That means the Gen application is trying to load a dependent dll which cannot be found.

Resolution

To troubleshoot, it is best to use Dependency Walker to determine the missing dll: http://www.dependencywalker.com

For this particular scenario, Dependency Walker showed that the following DLLs were missing:
api-ms-win-core-winrt-error-l1-1-0.dll 
api-ms-win-core-winrt-l1-1-0.dll 
api-ms-win-core-winrt-robuffer-l1-1-0.dll 
api-ms-win-core-winrt-string-l1-1-0.dll 

An internet search revealed these DLLs are part of the Visual Studio redistributable. Installing the 32-bit Visual Studio redistributable resolved the problem (note Gen applications are 32-bit).

Additional Information

NOTE: Due to generic nature of the 126 error, Dependency Walker may show different missing dll file(s), so the resolution will depend on what it shows.