Skip to content

Report Windows exit codes as int32 in the "exited" event - #2103

Merged
Rich Chiodo (rchiodo) merged 1 commit into
microsoft:mainfrom
Soarex16:windows-exit-code-int32
Nov 30, 2026
Merged

Rich Chiodo (rchiodo) merged 1 commit into
microsoft:mainfrom
Soarex16:windows-exit-code-int32

Conversation

@Soarex16

Copy link
Copy Markdown
Contributor

On Windows, Popen.wait() returns the exit code as an unsigned 32-bit DWORD, and the launcher sent it unchanged in the exited event. A code with the high bit set, such as 0xC000013A (STATUS_CONTROL_C_EXIT), then falls outside the int32 range that the DAP schema requires for exitCode, so a client that decodes the field as an int32 rejects the event.

The launcher now maps a Windows exit code to the int32 with the same bits: 0xC000013A becomes -1073741510, and 0xFFFFFFFF becomes -1.

Fixes #2102

On Windows, `Popen.wait()` returns the exit code as an unsigned 32-bit `DWORD`, and the launcher sent it unchanged in the `exited` event. A code with the high bit set, such as `0xC000013A` (`STATUS_CONTROL_C_EXIT`), then falls outside the int32 range that the DAP schema requires for `exitCode`, so a client that decodes the field as an int32 rejects the event.

The launcher now maps a Windows exit code to the int32 with the same bits: `0xC000013A` becomes `-1073741510`, and `0xFFFFFFFF` becomes `-1`.

Fixes microsoft#2102
@Soarex16
Shumaf Lovpache (Soarex16) requested a review from a team as a code owner November 27, 2026 15:54
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@rchiodo

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@Soarex16

Copy link
Copy Markdown
Contributor Author

It seems like the failed test is flaky. I'll try to restart if I have permissions for that

@Soarex16

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 2103 in repo microsoft/debugpy

@Soarex16

Copy link
Copy Markdown
Contributor Author

I do not have the permissions to re-run the pipeline. Could you please re-run the failed job? As I see tests/debugpy/test_threads.py::test_thread_count also fails on the main:

@rchiodo

Copy link
Copy Markdown
Contributor

Yeah pytest is flakey with distributed runs. As long as some of the windows runs passed, that means it's working.

@rchiodo
Rich Chiodo (rchiodo) merged commit 203a480 into microsoft:main Nov 30, 2026
24 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exited event reports Windows exit codes as uint32, outside the int32 range of the DAP schema

2 participants