Skip to content

Is lazy loading system functions on UWP still necessary? #143530

Closed

Description

@ChrisDenton

Currently we lazy load some system functions that were restricted on UWP. See here, for example:

#[cfg(target_vendor = "uwp")]
pub fn NtCreateFile(

However, I'm told that Microsoft stopped enforcing the requirement that store applications (even strictly UWP ones) only use certain APIs in 2020. There is now nothing that block applications from using such APIs unless they're completely restricted functions, (e.g. win32 UI APIs) which would block lazy loading too. There is still a tool that may report certain APIs but that isn't, I'm told, actually relevant nowadays.

cc @bdbai @riverar

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jul 6, 2025
  2. added
    O-windowsOperating system: Windows
    T-libsRelevant to the library team, which will review and decide on the PR/issue.
    O-uwp-windows-msvcWindows targets for Universal Windows Platform (UWP) applications, using MSVC toolchain.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jul 6, 2025
  3. bdbai commented on Jul 6, 2025

    @bdbai
    Contributor

    I think the end goal is just to allow UWP apps containing Rust code to build, link, run without issues, and eventually get certified and published to the store. iirc the default UWP app template in Visual Studio does not by default link against some "non-UWP" import libs that would fail linkage if the code references to those "non-UWP" APIs, but things may have changed. If the claims as @ChrisDenton being told are reliable, I am perfectly okay with removing lazy loading. In case some users encounter link errors for UWP apps, I would suggest we document the fix somewhere, that is to manually add the import libs in Visual Studio project settings.

  4. ChrisDenton commented on Jul 6, 2025

    @ChrisDenton
    MemberAuthor

    Another option is to raw-dylib in the standard library for UWP targets so that import libraries aren't needed at all.

  5. riverar commented on Jul 6, 2025

    @riverar
    Contributor

    The Windows App Certification Kit (WACK)--the tool @ChrisDenton alluded to--is no longer a suitable tool to measure what may/may not pass Microsoft Store certification. (For example, there are low-IL apps that target .NET 9 and fail the WACK today.)

    The Partner Center folks don't have much in the way of documentation on this topic. I've reached out to them to get more information, but I'd lean towards "yes, it's safe to link against now". Will update you as soon as I hear back.

  6. riverar commented on Jul 6, 2025

    @riverar
    Contributor

    Got confirmation from @Sergio0694 that Win32 APIs aren't validated anymore.

  7. ChrisDenton commented on Jul 7, 2025

    @ChrisDenton
    MemberAuthor

    Thanks for getting the confirmation.

    @bdbai I opened #143592 to remove the lazy loading while still not requiring users to have all the import libs.

  8. bdbai commented on Jul 7, 2025

    @bdbai
    Contributor

    @ChrisDenton I totally forgot the raw-dylib feature😅 But thanks for the enhancement!

  9. added 3 commits that reference this issue on Jul 14, 2025
    ba209f6
    e3482ff
    2f87953
  10. added a commit that references this issue on Jul 17, 2025
    af7d9d8
  11. added a commit that references this issue on Jul 21, 2025
    d1e25fe
  12. added a commit that references this issue on Jul 29, 2025
    cec50f1
  13. added a commit that references this issue on Dec 21, 2025
    226fdb6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-uwp-windows-msvcWindows targets for Universal Windows Platform (UWP) applications, using MSVC toolchain.O-windowsOperating system: WindowsT-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions