From 8a90fc8566322ab5f4f031368c394814a35cba3f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 07:33:09 +0000 Subject: [PATCH 01/12] Initial plan From 2f34cf93cfcbaaecff89a9ccce4f51f52b478cbc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 07:39:05 +0000 Subject: [PATCH 02/12] Add SIGKILL enumeration value and validation Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> --- .../System.Private.CoreLib/src/Resources/Strings.resx | 3 +++ .../src/System/Runtime/InteropServices/PosixSignal.cs | 6 +++++- .../Runtime/InteropServices/PosixSignalRegistration.cs | 5 +++++ .../ref/System.Runtime.InteropServices.cs | 2 ++ .../InteropServices/PosixSignalRegistrationTests.Unix.cs | 7 ++++++- .../InteropServices/PosixSignalRegistrationTests.cs | 6 ++++++ src/native/libs/System.Native/pal_signal.c | 7 +++++++ src/native/libs/System.Native/pal_signal.h | 3 ++- 8 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx index f511ebeb21810d..4089e9f65fe517 100644 --- a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx @@ -259,6 +259,9 @@ The usage of IKeyComparer and IHashCodeProvider/IComparer interfaces cannot be mixed; use one or the other. + + Cannot register a handler for SIGKILL. + Attempt to unload the AppDomain failed. diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignal.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignal.cs index e1f278fbd6f557..cc047934908651 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignal.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignal.cs @@ -42,6 +42,10 @@ public enum PosixSignal /// Stop typed at terminal [UnsupportedOSPlatform("windows")] - SIGTSTP = -10 + SIGTSTP = -10, + + /// Kill (cannot be caught or ignored) + [UnsupportedOSPlatform("windows")] + SIGKILL = -11 } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs index a804ae68486cbc..a384d2eeb1da5f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs @@ -39,6 +39,11 @@ public static PosixSignalRegistration Create(PosixSignal signal, Action UninstallableSignals() public static IEnumerable SupportedSignals() { foreach (PosixSignal value in Enum.GetValues(typeof(PosixSignal))) - yield return new object[] { value }; + { + if (value != PosixSignal.SIGKILL) + { + yield return new object[] { value }; + } + } } public static IEnumerable UnsupportedSignals() diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.cs index 4f800d51dca44b..4c1897ed3ed552 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.cs @@ -18,6 +18,12 @@ public void Create_NullHandler_Throws() AssertExtensions.Throws("handler", () => PosixSignalRegistration.Create(PosixSignal.SIGCONT, null)); } + [Fact] + public void Create_SIGKILL_Throws() + { + AssertExtensions.Throws("signal", () => PosixSignalRegistration.Create(PosixSignal.SIGKILL, ctx => { })); + } + [Theory] [MemberData(nameof(UnsupportedSignals))] public void Create_InvalidSignal_Throws(PosixSignal signal) diff --git a/src/native/libs/System.Native/pal_signal.c b/src/native/libs/System.Native/pal_signal.c index 352458c8719f08..33be19b7faf37d 100644 --- a/src/native/libs/System.Native/pal_signal.c +++ b/src/native/libs/System.Native/pal_signal.c @@ -129,6 +129,10 @@ static bool TryConvertSignalCodeToPosixSignal(int signalCode, PosixSignal* posix *posixSignal = PosixSignalSIGTSTP; return true; + case SIGKILL: + *posixSignal = PosixSignalSIGKILL; + return true; + default: *posixSignal = (PosixSignal)signalCode; return false; @@ -169,6 +173,9 @@ int32_t SystemNative_GetPlatformSignalNumber(PosixSignal signal) case PosixSignalSIGTSTP: return SIGTSTP; + case PosixSignalSIGKILL: + return SIGKILL; + case PosixSignalInvalid: break; } diff --git a/src/native/libs/System.Native/pal_signal.h b/src/native/libs/System.Native/pal_signal.h index c3c21009dc836c..d462b611ccb5de 100644 --- a/src/native/libs/System.Native/pal_signal.h +++ b/src/native/libs/System.Native/pal_signal.h @@ -44,7 +44,8 @@ typedef enum PosixSignalSIGWINCH = -7, PosixSignalSIGTTIN = -8, PosixSignalSIGTTOU = -9, - PosixSignalSIGTSTP = -10 + PosixSignalSIGTSTP = -10, + PosixSignalSIGKILL = -11 } PosixSignal; typedef int32_t (*PosixSignalHandler)(int32_t signalCode, PosixSignal signal); From d319cb4e5f7e63834916417e38e2abb3502c2c39 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 07:58:34 +0000 Subject: [PATCH 03/12] Fix SIGKILL validation for raw signal values and exclude from test data Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> --- .../InteropServices/PosixSignalRegistration.Unix.cs | 7 +++++++ .../InteropServices/PosixSignalRegistrationTests.Unix.cs | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs index bd5a09dfe48fdc..8bb4af33c4d2f6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs @@ -31,6 +31,13 @@ private static PosixSignalRegistration Register(PosixSignal signal, Action PosixSignalAsRawValues var data = new TheoryData(); foreach (var value in Enum.GetValues(typeof(PosixSignal))) { - int signo = GetPlatformSignalNumber((PosixSignal)value); + PosixSignal signal = (PosixSignal)value; + if (signal == PosixSignal.SIGKILL) + { + continue; // SIGKILL cannot be registered + } + int signo = GetPlatformSignalNumber(signal); Assert.True(signo > 0, "Expected raw signal number to be greater than 0."); data.Add((PosixSignal)signo); } From f4a7d09a97067366339d5ce8a5a008d4cb300173 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 08:00:32 +0000 Subject: [PATCH 04/12] Cache SIGKILL signal number to avoid repeated interop calls Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> --- .../Runtime/InteropServices/PosixSignalRegistration.Unix.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs index 8bb4af33c4d2f6..41ad93144583d6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs @@ -10,6 +10,7 @@ namespace System.Runtime.InteropServices public sealed partial class PosixSignalRegistration { private static readonly Dictionary> s_registrations = Initialize(); + private static readonly int s_sigkillNumber = Interop.Sys.GetPlatformSignalNumber(PosixSignal.SIGKILL); private static unsafe Dictionary> Initialize() { @@ -32,8 +33,7 @@ private static PosixSignalRegistration Register(PosixSignal signal, Action Date: Wed, 11 Feb 2026 08:21:40 +0000 Subject: [PATCH 05/12] Move SIGKILL validation to platform-agnostic Create method Per feedback from @adamsitnik, moved SIGKILL validation from the Unix-specific Register method to the platform-agnostic Create method. The validation now checks both the SIGKILL enum value (-11) and the raw POSIX signal number (9), ensuring SIGKILL cannot be registered on any platform. Removed the s_sigkillNumber field as it's no longer needed. Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> --- .../InteropServices/PosixSignalRegistration.Unix.cs | 7 ------- .../Runtime/InteropServices/PosixSignalRegistration.cs | 4 +++- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs index 41ad93144583d6..bd5a09dfe48fdc 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.Unix.cs @@ -10,7 +10,6 @@ namespace System.Runtime.InteropServices public sealed partial class PosixSignalRegistration { private static readonly Dictionary> s_registrations = Initialize(); - private static readonly int s_sigkillNumber = Interop.Sys.GetPlatformSignalNumber(PosixSignal.SIGKILL); private static unsafe Dictionary> Initialize() { @@ -32,12 +31,6 @@ private static PosixSignalRegistration Register(PosixSignal signal, Action Date: Wed, 11 Feb 2026 08:23:46 +0000 Subject: [PATCH 06/12] Use named constant for SIGKILL raw signal number Replaced magic number 9 with SIGKILL_POSIX_SIGNAL_NUMBER constant for better code clarity and maintainability. Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> --- .../Runtime/InteropServices/PosixSignalRegistration.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs index 39b8eadf1bb070..7b3b63c21a4260 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs @@ -9,6 +9,9 @@ namespace System.Runtime.InteropServices /// Handles a . public sealed partial class PosixSignalRegistration : IDisposable { + /// The raw signal number for SIGKILL on POSIX systems. + private const int SIGKILL_POSIX_SIGNAL_NUMBER = 9; + /// The state associated with this registration. /// /// This is separate from the registration instance so that this token may be stored @@ -41,7 +44,7 @@ public static PosixSignalRegistration Create(PosixSignal signal, Action Date: Wed, 11 Feb 2026 08:25:42 +0000 Subject: [PATCH 07/12] Clarify comment about SIGKILL validation checks Updated comment to clarify that we check both PosixSignal.SIGKILL (-11) and raw signal number 9 cast to enum type (e.g., (PosixSignal)9). Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> --- .../System/Runtime/InteropServices/PosixSignalRegistration.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs index 7b3b63c21a4260..23fb10a37b0e51 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs @@ -43,7 +43,8 @@ public static PosixSignalRegistration Create(PosixSignal signal, Action Date: Wed, 11 Feb 2026 08:59:21 +0000 Subject: [PATCH 08/12] Throw IOException for SIGKILL and remove raw signal number check Per feedback from @jkotas and @adamsitnik: - Changed exception from ArgumentException to IOException to match OS behavior - Removed check for raw signal number (9) - let OS throw IOException naturally - Only check PosixSignal.SIGKILL enum value to provide better error message - Updated test to expect IOException instead of ArgumentException - Removed unused SIGKILL_POSIX_SIGNAL_NUMBER constant This avoids a breaking change where the exception type would differ for raw signal numbers vs enum values. Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> --- .../Runtime/InteropServices/PosixSignalRegistration.cs | 9 ++------- .../InteropServices/PosixSignalRegistrationTests.cs | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs index 23fb10a37b0e51..ad09f8156dc42a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs @@ -9,9 +9,6 @@ namespace System.Runtime.InteropServices /// Handles a . public sealed partial class PosixSignalRegistration : IDisposable { - /// The raw signal number for SIGKILL on POSIX systems. - private const int SIGKILL_POSIX_SIGNAL_NUMBER = 9; - /// The state associated with this registration. /// /// This is separate from the registration instance so that this token may be stored @@ -43,11 +40,9 @@ public static PosixSignalRegistration Create(PosixSignal signal, Action("signal", () => PosixSignalRegistration.Create(PosixSignal.SIGKILL, ctx => { })); + Assert.Throws(() => PosixSignalRegistration.Create(PosixSignal.SIGKILL, ctx => { })); } [Theory] From fb5b0ac8188437f83e5d843a513a6fcc5dcaf1d7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 11:31:28 +0000 Subject: [PATCH 09/12] Remove SIGKILL validation from Create method Per feedback from @jkotas and @adamsitnik: - Removed SIGKILL check from platform-agnostic Create method - Removed Arg_CannotRegisterHandlerForSIGKILL resource string - Let OS-specific Register methods throw naturally: - Unix: IOException from OS when trying to enable signal handling - Windows: PlatformNotSupportedException (SIGKILL not in switch) - Updated tests to be platform-specific: - Unix test expects IOException - Windows test expects PlatformNotSupportedException This allows the OS to handle validation naturally without adding extra checks that provide no value. Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> --- .../System.Private.CoreLib/src/Resources/Strings.resx | 3 --- .../Runtime/InteropServices/PosixSignalRegistration.cs | 6 ------ .../InteropServices/PosixSignalRegistrationTests.Unix.cs | 7 +++++++ .../PosixSignalRegistrationTests.Windows.cs | 7 +++++++ .../InteropServices/PosixSignalRegistrationTests.cs | 6 ------ 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx index 4089e9f65fe517..f511ebeb21810d 100644 --- a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx @@ -259,9 +259,6 @@ The usage of IKeyComparer and IHashCodeProvider/IComparer interfaces cannot be mixed; use one or the other. - - Cannot register a handler for SIGKILL. - Attempt to unload the AppDomain failed. diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs index ad09f8156dc42a..a804ae68486cbc 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/PosixSignalRegistration.cs @@ -39,12 +39,6 @@ public static PosixSignalRegistration Create(PosixSignal signal, Action(() => PosixSignalRegistration.Create(PosixSignal.SIGKILL, ctx => { })); + } + public static IEnumerable UninstallableSignals() { yield return new object[] { (PosixSignal)9 }; diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Windows.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Windows.cs index 7564a2b5c4afa7..ee280989b742b2 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Windows.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Windows.cs @@ -11,6 +11,13 @@ namespace System.Tests { public partial class PosixSignalRegistrationTests { + [Fact] + public void Create_SIGKILL_Throws() + { + // SIGKILL is not supported on Windows + Assert.Throws(() => PosixSignalRegistration.Create(PosixSignal.SIGKILL, ctx => { })); + } + public static IEnumerable UninstallableSignals() => Enumerable.Empty(); public static IEnumerable SupportedSignals() => SupportedPosixSignals.Select(p => new object[] { p }); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.cs index 2efca6773b0c58..4f800d51dca44b 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.cs @@ -18,12 +18,6 @@ public void Create_NullHandler_Throws() AssertExtensions.Throws("handler", () => PosixSignalRegistration.Create(PosixSignal.SIGCONT, null)); } - [Fact] - public void Create_SIGKILL_Throws() - { - Assert.Throws(() => PosixSignalRegistration.Create(PosixSignal.SIGKILL, ctx => { })); - } - [Theory] [MemberData(nameof(UnsupportedSignals))] public void Create_InvalidSignal_Throws(PosixSignal signal) From 36563741245e4410b3f4fdb98e950eb7250b37a5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:12:12 +0000 Subject: [PATCH 10/12] Add missing using System.IO directive to Unix tests Fixed build error: Added missing 'using System.IO;' directive to PosixSignalRegistrationTests.Unix.cs to resolve IOException reference. Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> --- .../Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs index 68466b536d8939..08a40a38bfbc93 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs @@ -4,6 +4,7 @@ using Xunit; using System.Diagnostics; using System.Globalization; +using System.IO; using System.Threading; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; From f898c17f532480b2fcc6c1712c43c72dd3a3eb70 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 15:11:55 +0000 Subject: [PATCH 11/12] Move SIGKILL to UninstallableSignals and remove redundant tests Per @jkotas feedback: add PosixSignal.SIGKILL to UninstallableSignals() on Unix so it's covered by Create_UninstallableSignal_Throws, and delete the explicit Create_SIGKILL_Throws tests from both Unix and Windows files (the Windows test was redundant with Create_InvalidSignal_Throws). Also remove the now-unnecessary 'using System.IO;' directive from the Unix file. Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> --- .../InteropServices/PosixSignalRegistrationTests.Unix.cs | 9 +-------- .../PosixSignalRegistrationTests.Windows.cs | 7 ------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs index 08a40a38bfbc93..95c728174adf03 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs @@ -4,7 +4,6 @@ using Xunit; using System.Diagnostics; using System.Globalization; -using System.IO; using System.Threading; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; @@ -15,15 +14,9 @@ namespace System.Tests { public partial class PosixSignalRegistrationTests { - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMobile))] - public void Create_SIGKILL_Throws() - { - // OS throws IOException when trying to install a handler for SIGKILL - Assert.Throws(() => PosixSignalRegistration.Create(PosixSignal.SIGKILL, ctx => { })); - } - public static IEnumerable UninstallableSignals() { + yield return new object[] { PosixSignal.SIGKILL }; yield return new object[] { (PosixSignal)9 }; } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Windows.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Windows.cs index ee280989b742b2..7564a2b5c4afa7 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Windows.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Windows.cs @@ -11,13 +11,6 @@ namespace System.Tests { public partial class PosixSignalRegistrationTests { - [Fact] - public void Create_SIGKILL_Throws() - { - // SIGKILL is not supported on Windows - Assert.Throws(() => PosixSignalRegistration.Create(PosixSignal.SIGKILL, ctx => { })); - } - public static IEnumerable UninstallableSignals() => Enumerable.Empty(); public static IEnumerable SupportedSignals() => SupportedPosixSignals.Select(p => new object[] { p }); From 4813de4b7a02c7e7ddcf0ab11c8abc9e724fca62 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 01:39:54 +0000 Subject: [PATCH 12/12] Exclude SIGKILL from ProcessTests.SignalTestData SIGKILL cannot be caught or ignored, so iterating all PosixSignal enum values to register handlers fails for SIGKILL with IOException. Skip it in the test data, consistent with how SIGKILL is excluded from SupportedSignals in PosixSignalRegistrationTests. Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> --- .../System.Diagnostics.Process/tests/ProcessTests.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs index 901cfcfa78a024..be23483549c60d 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs @@ -93,6 +93,10 @@ public static IEnumerable SignalTestData() { foreach (PosixSignal signal in Enum.GetValues()) { + if (signal == PosixSignal.SIGKILL) + { + continue; // SIGKILL cannot be caught or ignored + } yield return new object[] { signal }; } // Test a few raw signals.