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
This 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": reference Microsoft > System Error Codes (0-499)
The error happens because the Gen application is trying to load a dependent dll which cannot be found.
Component: Gen Runtime, GUI
To troubleshoot, it is best to use Dependency Walker to determine the missing dll: Dependency Walker
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 (Gen applications are 32-bit).
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.