diff --git a/eng/versioning.targets b/eng/versioning.targets index 9e6d9de071847..12cad8bf7f1a6 100644 --- a/eng/versioning.targets +++ b/eng/versioning.targets @@ -36,11 +36,16 @@ true - + + + + + + <_unsupportedOSPlatforms Include="$(UnsupportedOSPlatforms)" /> diff --git a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs index 599378b6ea04d..4b536fd86d54e 100644 --- a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs +++ b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs @@ -108,15 +108,29 @@ public static void EnterDebugMode() { } public static System.Diagnostics.Process[] GetProcesses(string machineName) { throw null; } public static System.Diagnostics.Process[] GetProcessesByName(string? processName) { throw null; } public static System.Diagnostics.Process[] GetProcessesByName(string? processName, string machineName) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public void Kill() { } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public void Kill(bool entireProcessTree) { } public static void LeaveDebugMode() { } protected void OnExited() { } public void Refresh() { } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public bool Start() { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Diagnostics.Process? Start(System.Diagnostics.ProcessStartInfo startInfo) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Diagnostics.Process Start(string fileName) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Diagnostics.Process Start(string fileName, string arguments) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Diagnostics.Process Start(string fileName, System.Collections.Generic.IEnumerable arguments) { throw null; } [System.CLSCompliantAttribute(false)] [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.NonUap.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.NonUap.cs index be09b7bb146ef..d2c05302f719f 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.NonUap.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.NonUap.cs @@ -3,11 +3,14 @@ using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.Versioning; namespace System.Diagnostics { public partial class Process : IDisposable { + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public void Kill(bool entireProcessTree) { if (!entireProcessTree) diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs index 704fab865eb0f..05eee69f480a6 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs @@ -54,8 +54,15 @@ public static Process Start(string fileName, string arguments, string userName, } /// Terminates the associated process immediately. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public void Kill() { + if (OperatingSystem.IsIOS() || OperatingSystem.IsTvOS()) + { + throw new PlatformNotSupportedException(); + } + EnsureState(State.HaveId); // Check if we know the process has exited. This avoids us targetting another @@ -345,6 +352,11 @@ private SafeProcessHandle GetProcessHandle() /// The start info with which to start the process. private bool StartCore(ProcessStartInfo startInfo) { + if (OperatingSystem.IsIOS() || OperatingSystem.IsTvOS()) + { + throw new PlatformNotSupportedException(); + } + EnsureInitialized(); string? filename; diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs index 0dfc4ae2357cb..475f31853f4d9 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs @@ -89,6 +89,8 @@ public static void LeaveDebugMode() } /// Terminates the associated process immediately. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public void Kill() { using (SafeProcessHandle handle = GetProcessHandle(Interop.Advapi32.ProcessOptions.PROCESS_TERMINATE | Interop.Advapi32.ProcessOptions.PROCESS_QUERY_LIMITED_INFORMATION, throwIfExited: false)) diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs index 6c9181f8655d6..1aec8ec89756f 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs @@ -2,16 +2,16 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Win32.SafeHandles; +using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Globalization; using System.IO; using System.Runtime.Serialization; +using System.Runtime.Versioning; using System.Text; using System.Threading; using System.Threading.Tasks; -using System.Runtime.Versioning; -using System.Collections.Generic; namespace System.Diagnostics { @@ -1197,6 +1197,8 @@ private void SetProcessId(int processId) /// component. /// /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public bool Start() { Close(); @@ -1238,6 +1240,8 @@ public bool Start() /// component. /// /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static Process Start(string fileName) { // the underlying Start method can only return null on Windows platforms, @@ -1254,6 +1258,8 @@ public static Process Start(string fileName) /// component. /// /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static Process Start(string fileName, string arguments) { // the underlying Start method can only return null on Windows platforms, @@ -1265,6 +1271,8 @@ public static Process Start(string fileName, string arguments) /// /// Starts a process resource by specifying the name of an application and a set of command line arguments /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static Process Start(string fileName, IEnumerable arguments) { if (fileName == null) @@ -1289,6 +1297,8 @@ public static Process Start(string fileName, IEnumerable arguments) /// component. /// /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static Process? Start(ProcessStartInfo startInfo) { Process process = new Process();