-
Notifications
You must be signed in to change notification settings - Fork 427
Setting WindowsPackageType=None should delay-load all WinAppSDK import libraries #1117
Copy link
Copy link
Open
Open
Copy link
Labels
area-DynamicDependenciesDynamicDependency for Windows App SDK: enables framework packages for packaged & unpackaged appsDynamicDependency for Windows App SDK: enables framework packages for packaged & unpackaged appsfeature proposal
Milestone
Description
@niklasb-ms discovered that using WinAppSDK from an unpackaged app using dynamic dependencies can cause the exe to fail to launch with a "module not found" error. This appears to be caused by the exe getting a static-import record for dwritecore.dll, which isn't in the loader's paths until MddBoostrapInitialize is called. Switching to a LoadLibrary or a DELAYLOAD import of the DLL works fine.
So:
- Unpackaged (like MSI) using WinAppSDK (any version)
- App calls
DWriteCoreCreateFactoryin itsWinMain - App crashes at launch with
ERROR_MOD_NOT_FOUND
Potential solution:
When the project has <WindowsPackageType>None</WindowsPackageType> all WinAppSDK DLLs should be delay-loaded. This can be done with by adding a /delayload:dllname linker option, per https://docs.microsoft.com/en-us/cpp/build/reference/linker-support-for-delay-loaded-dlls?view=msvc-160
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-DynamicDependenciesDynamicDependency for Windows App SDK: enables framework packages for packaged & unpackaged appsDynamicDependency for Windows App SDK: enables framework packages for packaged & unpackaged appsfeature proposal