Windows AppContainer process fails to start with error 0xC0000142

2026-11-05T17:57:43.16+00:00

I need help diagnosing a Windows application startup problem. A Python process exits with error 0xC0000142 (STATUS_DLL_INIT_FAILED) before it produces any output.

A simple Python startup test fails with the same error in both an ordinary AppContainer and an LPAC container. The test does not open a PDF or load PDF libraries. The Windows Application log showed no relevant errors during the test.

How can I identify which DLL or resource is failing during startup while keeping the AppContainer security protections in place? Is there a Windows developer or AppContainer specialist who can help?

Windows development | Windows API - Win32
0 comments No comments

1 answer

Sort by: Oldest
  1. Harry Nguyen (WICLOUD CORPORATION) 610 Reputation points Microsoft External Staff Moderator
    2026-11-06T03:39:54.1166667+00:00

    Hi @jkrause berkeleyconstructors.com ,

    0xC0000142 (STATUS_DLL_INIT_FAILED) indicates a failure during DLL initialization, but the status alone does not identify the module or resource responsible.

    I would first trace the startup while keeping the current AppContainer/LPAC configuration unchanged. Possible causes include a dependency failing to load, a DLL failing during initialization, or initialization attempting to access a resource unavailable inside the container.

    Start with Process Monitor:

    1. Run Process Monitor elevated and start capturing.
    2. Launch python.exe through the same AppContainer/LPAC launcher.
    3. Stop the capture after it exits.
    4. Use Tools > Process Tree to locate python.exe and add it as an Include filter.
    5. Inspect the events immediately preceding Thread Exit / Process Exit, especially file, registry, and image-loading activity.

    Microsoft documents this workflow in Troubleshoot Apps failing to start using Process Monitor. It also notes that not every ACCESS DENIED result is necessarily the cause, so nearby failures should be evaluated in context.

    If Process Monitor does not isolate the issue, enable Show Loader Snaps for Python:

    gflags /i python.exe +sls 
    

    Show Loader Snaps provides detailed information about executable and DLL loading and unloading, and Microsoft documents the same gflags /i <image> +sls syntax in Example 2: Setting a Flag by Using a Flag Abbreviation.

    I would avoid disabling the sandbox or broadly changing permissions until the trace identifies a specific resource. This is particularly important with LPAC, which Microsoft documents as providing greater isolation than a regular AppContainer and requiring explicit capabilities for resources that regular AppContainers may otherwise access. See Launch an AppContainer.

    If possible, please share the Process Monitor events immediately preceding the python.exe exit. That should help determine whether this is a DLL initialization/loading issue or a resource-access issue.

    If you found this helpful, you can refer to this guidance to confirm it and help others with similar questions.

    Thank you.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.