microsoft/aspire · error · Win32Exception
Failed to invoke InitializeProcThreadAttributeList while…
Error message
Failed to invoke InitializeProcThreadAttributeList while starting tracked browser CDP pipe.
What it means
A Win32Exception wrapping GetLastError from InitializeProcThreadAttributeList in CreateWindowsProcess (BrowserLogsPipeBrowserProcessLauncher.Windows.cs:88). Aspire uses an extended STARTUPINFO attribute list to restrict handle inheritance to exactly the two CDP pipe handles when launching Chromium; failure here means the attribute list could not be prepared, so the browser cannot be started on the pipe transport.
Solutions
- Read NativeErrorCode (ex.Message includes the Win32 error) and check system memory availability.
- Retry after freeing memory or increasing the machine/container memory limit.
- Disable or exclude injective antivirus/EDR hooking of process creation for the AppHost process.
- Run the latest Aspire version; if persistent, report at https://github.com/microsoft/aspire/issues with the Win32 error code.
- Consider the WebSocket CDP transport as a fallback if the pipe transport cannot start.
Defensive patterns
Strategy: try-catch
Type guard
static bool IsInitAttrListFailure(Win32Exception ex) => ex.Message.Contains("InitializeProcThreadAttributeList"); Try / catch
try
{
StartBrowserPipeWindows();
}
catch (Win32Exception ex) when (IsInitAttrListFailure(ex))
{
logger.LogError(ex, "InitializeProcThreadAttributeList failed (Win32 error {Errno}). Check memory and security software.", ex.NativeErrorCode);
throw;
} Prevention
- Keep sufficient free memory on Windows hosts/containers.
- Exclude the AppHost from injective antivirus/EDR hooks on process creation.
- Keep Aspire and the .NET runtime up to date.
- Fall back to the WebSocket CDP transport if pipe launch keeps failing.
When it happens
Trigger: InitializeProcThreadAttributeList returns FALSE during StartWindows — typically ERROR_INSUFFICIENT_BUFFER (size mismatch after AllocHGlobal) or ERROR_NOT_ENOUGH_MEMORY when the heap allocation cannot back the list.
Common situations: Severe memory pressure on the host; corrupted kernel32 state after unusual injection/hooking software (antivirus, App-V); essentially never caused by user configuration.
Related errors
- Failed to invoke CreateProcessW while starting tracked…
- Failed to invoke CloseHandle while starting tracked browser…
- Failed to invoke GetExitCodeProcess while starting tracked…
- Failed to invoke UpdateProcThreadAttribute while starting…
- Failed to invoke WaitForSingleObject while starting tracked…
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/bd2ce7dfc0803b0a.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Browsers/BrowserLogsPipeBrowserProcessLauncher.Windows.cs:88
}
private static WindowsProcessInfo CreateWindowsProcess(string executablePath, IReadOnlyList<string> arguments, IntPtr[] inheritedHandles)
{
var commandLine = Marshal.StringToHGlobalUni(BuildWindowsCommandLine(executablePath, arguments));
var attributeListSize = UIntPtr.Zero;
// STARTUPINFOEX + PROC_THREAD_ATTRIBUTE_HANDLE_LIST lets us turn on handle inheritance while limiting it to the
// two CDP pipe handles. That avoids the broad "all inheritable handles leak into Chromium" behavior of plain
// CreateProcess(..., inheritHandles: true).
_ = InitializeProcThreadAttributeList(IntPtr.Zero, 1, 0, ref attributeListSize);
var attributeList = Marshal.AllocHGlobal((nint)attributeListSize.ToUInt64());
var handleList = Marshal.AllocHGlobal(IntPtr.Size * inheritedHandles.Length);
var startupInfoPointer = IntPtr.Zero;
try
{
if (!InitializeProcThreadAttributeList(attributeList, 1, 0, ref attributeListSize))
{
throw CreateWindowsException("InitializeProcThreadAttributeList");
}
for (var i = 0; i < inheritedHandles.Length; i++)
{
Marshal.WriteIntPtr(handleList, i * IntPtr.Size, inheritedHandles[i]);
}
if (!UpdateProcThreadAttribute(
attributeList,
0,
s_procThreadAttributeHandleList,
handleList,
(UIntPtr)(uint)(IntPtr.Size * inheritedHandles.Length),
IntPtr.Zero,
IntPtr.Zero))
{
throw CreateWindowsException("UpdateProcThreadAttribute");
}View on GitHub (pinned to 25830f84bd)