Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
abb8c0e
Implement ProcessStartInfo.KillOnParentExit for Windows
Copilot Apr 9, 2026
31f6e6b
Address review feedback: defensive UserName check, resume only on hap…
Copilot Apr 9, 2026
b910623
address my own feedback:
adamsitnik Apr 9, 2026
cc04598
Address review feedback: add SupportedOSPlatform("windows"), check Re…
Copilot Apr 9, 2026
afab02e
Add Windows SDK doc link for JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE and r…
Copilot Apr 10, 2026
309480c
increase test coverage:
adamsitnik Apr 10, 2026
f0f9714
fix a bug discovered by the tests: when all standard handles are inva…
adamsitnik Apr 10, 2026
7f887bd
Don't create (and upload) a memory dump for this test, as AV is inten…
adamsitnik Apr 10, 2026
afbcc1e
Merge remote-tracking branch 'origin/main' into copilot/add-kill-on-p…
adamsitnik Apr 10, 2026
ede5e33
Apply suggestions from code review
adamsitnik Apr 10, 2026
9bb0ef4
Apply suggestions from code review
adamsitnik Apr 10, 2026
7b0e652
make the tests less flaky
adamsitnik Apr 10, 2026
c432cd5
refactor the code: move all logic related to extended startup info in…
adamsitnik Apr 10, 2026
6bae099
Merge branch 'main' into copilot/add-kill-on-parent-exit-property
adamsitnik Apr 10, 2026
bbab88f
Update src/libraries/System.Diagnostics.Process/tests/KillOnParentExi…
jkotas Apr 11, 2026
baea489
Move ResumeThread P/Invoke to dedicated file and remove redundant Ski…
Copilot Apr 11, 2026
4fdc31a
Use nuint for numerical fields in job object structs and fix processI…
Copilot Apr 11, 2026
04d67a9
Change ResumeThread return type to uint (matches DWORD) and remove in…
Copilot Apr 11, 2026
20559e0
Use IsInvalidHandle for thread handle assertion (checks both 0 and -1)
Copilot Apr 11, 2026
35b273c
try to avoid creating a memory dump
adamsitnik Apr 11, 2026
8beb026
Apply suggestions from code review
adamsitnik Apr 11, 2026
c5b7d59
Replace local ResumeThread P/Invoke in ProcessHandlesTests with share…
Copilot Apr 11, 2026
84ca617
Remove unused System.Runtime.InteropServices using after removing loc…
Copilot Apr 11, 2026
96e2804
Remove defensive HELIX_WORKITEM_UPLOAD_ROOT env var from crash test
Copilot Apr 11, 2026
f497166
Address jkotas feedback: remove unused enum, unnecessary early return…
Copilot Apr 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ internal static partial class StartupInfoOptions
internal const int CREATE_UNICODE_ENVIRONMENT = 0x00000400;
internal const int CREATE_NO_WINDOW = 0x08000000;
internal const int CREATE_NEW_PROCESS_GROUP = 0x00000200;
internal const int CREATE_SUSPENDED = 0x00000004;
internal const int DETACHED_PROCESS = 0x00000008;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;

internal static partial class Interop
{
internal static partial class Kernel32
{
internal sealed class SafeJobHandle : SafeHandleZeroOrMinusOneIsInvalid
{
public SafeJobHandle() : base(true) { }

protected override bool ReleaseHandle() => Interop.Kernel32.CloseHandle(handle);
}

[LibraryImport(Libraries.Kernel32, SetLastError = true)]
internal static partial SafeJobHandle CreateJobObjectW(IntPtr lpJobAttributes, IntPtr lpName);

internal const uint JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x00002000;

internal enum JOBOBJECTINFOCLASS
{
JobObjectExtendedLimitInformation = 9
}

[StructLayout(LayoutKind.Sequential)]
internal struct IO_COUNTERS
{
internal ulong ReadOperationCount;
internal ulong WriteOperationCount;
internal ulong OtherOperationCount;
internal ulong ReadTransferCount;
internal ulong WriteTransferCount;
internal ulong OtherTransferCount;
}

[StructLayout(LayoutKind.Sequential)]
internal struct JOBOBJECT_BASIC_LIMIT_INFORMATION
{
internal long PerProcessUserTimeLimit;
internal long PerJobUserTimeLimit;
internal uint LimitFlags;
internal nuint MinimumWorkingSetSize;
internal nuint MaximumWorkingSetSize;
internal uint ActiveProcessLimit;
internal nuint Affinity;
internal uint PriorityClass;
internal uint SchedulingClass;
}

[StructLayout(LayoutKind.Sequential)]
internal struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION
{
internal JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
internal IO_COUNTERS IoInfo;
internal nuint ProcessMemoryLimit;
internal nuint JobMemoryLimit;
internal nuint PeakProcessMemoryUsed;
internal nuint PeakJobMemoryUsed;
}

[LibraryImport(Libraries.Kernel32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool SetInformationJobObject(SafeJobHandle hJob, JOBOBJECTINFOCLASS JobObjectInfoClass, ref JOBOBJECT_EXTENDED_LIMIT_INFORMATION lpJobObjectInfo, uint cbJobObjectInfoLength);

[LibraryImport(Libraries.Kernel32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool AssignProcessToJobObject(SafeJobHandle hJob, SafeProcessHandle hProcess);

internal const int PROC_THREAD_ATTRIBUTE_JOB_LIST = 0x0002000D;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

internal static partial class Interop
{
internal static partial class Kernel32
{
[LibraryImport(Libraries.Kernel32, SetLastError = true)]
internal static partial uint ResumeThread(IntPtr hThread);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ public ProcessStartInfo(string fileName, System.Collections.Generic.IEnumerable<
public string FileName { get { throw null; } set { } }
public System.Collections.Generic.IList<System.Runtime.InteropServices.SafeHandle>? InheritedHandles { get { throw null; } set { } }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public bool KillOnParentExit { get { throw null; } set { } }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public bool LoadUserProfile { get { throw null; } set { } }
[System.CLSCompliantAttribute(false)]
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
Expand Down
Loading
Loading