microsoft / microsoft/WindowsAppSDK
Setting WindowsPackageType=None should delay-load all WinAppSDK import libraries
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 471
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 28
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 `DWriteCoreCreateFactory` in its `WinMain`
* App crashes at launch with `ERROR_MOD_NOT_FOUND`
Potential solution:
When the project has `None` 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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.