microsoft/aspire · critical · Win32Exception

Failed to invoke CreateProcessW while starting tracked…

Error message

Failed to invoke CreateProcessW while starting tracked browser CDP pipe.

What it means

Aspire's tracked browser launcher on Windows calls the Win32 CreateProcessW API to spawn the browser process with a CDP pipe attached. When the OS call fails (returns FALSE), the launcher throws a Win32Exception-wrapped error naming 'CreateProcessW' so the underlying Win32 error code is preserved. This indicates the browser executable could not be started at all.

Solutions

  1. Verify the browser executable the launcher targets actually exists at the resolved path and launches manually.
  2. Check the inner Win32Exception NativeErrorCode for the exact OS reason (2=file not found, 5=access denied, 87=invalid parameter).
  3. Reinstall or repair the browser installation the launcher resolves.
  4. Run under an account/environment with permission to create child processes; check antivirus/EDR blocking.
  5. Update the Aspire.Hosting.Browsers package - launcher path-resolution may have fixes.
Defensive patterns

Strategy: validation

Validate before calling

var browserPath = ResolveBrowserPath(); // path the launcher will use
if (browserPath is null || !File.Exists(browserPath))
    throw new InvalidOperationException($"Browser executable not found: {browserPath}");

Try / catch

try
{
    await StartTrackedBrowserAsync();
}
catch (Win32Exception ex) when (ex.Message.Contains("CreateProcessW"))
{
    logger.LogError(ex, "Browser launch failed (Win32 error {Code}). Verify browser install and permissions.", ex.NativeErrorCode);
}

Prevention

When it happens

Trigger: CreateWindowsProcess calls CreateProcessW with EXTENDED_STARTUPINFO_PRESENT|CREATE_NO_WINDOW and it returns FALSE - typically because the browser executable path is invalid, the file is missing, the command line is malformed, or the caller lacks execute permission.

Common situations: Browser channel/install not present on the machine (Edge/Chrome missing or partially uninstalled); a misconfigured custom browser path; antivirus blocking process creation; restricted service account without rights to spawn processes.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/37690645dd7a999d. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Browsers/BrowserLogsPipeBrowserProcessLauncher.Windows.cs:131

                },
                lpAttributeList = attributeList
            };
            startupInfoPointer = Marshal.AllocHGlobal(Marshal.SizeOf<STARTUPINFOEX>());
            Marshal.StructureToPtr(startupInfo, startupInfoPointer, fDeleteOld: false);

            if (!CreateProcessW(
                lpApplicationName: IntPtr.Zero,
                lpCommandLine: commandLine,
                lpProcessAttributes: IntPtr.Zero,
                lpThreadAttributes: IntPtr.Zero,
                bInheritHandles: true,
                dwCreationFlags: EXTENDED_STARTUPINFO_PRESENT | CREATE_NO_WINDOW,
                lpEnvironment: IntPtr.Zero,
                lpCurrentDirectory: IntPtr.Zero,
                lpStartupInfo: startupInfoPointer,
                lpProcessInformation: out var processInformation))
            {
                throw CreateWindowsException("CreateProcessW");
            }

            return new WindowsProcessInfo(processInformation.dwProcessId, processInformation.hProcess, processInformation.hThread);
        }
        finally
        {
            DeleteProcThreadAttributeList(attributeList);
            Marshal.FreeHGlobal(startupInfoPointer);
            Marshal.FreeHGlobal(attributeList);
            Marshal.FreeHGlobal(handleList);
            Marshal.FreeHGlobal(commandLine);
        }
    }

    internal static string BuildWindowsCommandLine(string executablePath, IReadOnlyList<string> arguments)
    {
        var builder = new StringBuilder();
        AppendWindowsCommandLineArgument(builder, executablePath);

View on GitHub (pinned to 25830f84bd)