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 4c98a461f323e7..53a49f897c1a2e 100644 --- a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs +++ b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs @@ -84,7 +84,11 @@ public Process() { } public System.DateTime StartTime { get { throw null; } } public System.ComponentModel.ISynchronizeInvoke? SynchronizingObject { get { throw null; } set { } } public System.Diagnostics.ProcessThreadCollection Threads { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public System.TimeSpan TotalProcessorTime { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public System.TimeSpan UserProcessorTime { get { throw null; } } [System.ObsoleteAttribute("Process.VirtualMemorySize has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.VirtualMemorySize64 instead.")] public int VirtualMemorySize { get { throw null; } } @@ -106,9 +110,17 @@ public static void EnterDebugMode() { } public static System.Diagnostics.Process GetCurrentProcess() { throw null; } public static System.Diagnostics.Process GetProcessById(int processId) { throw null; } public static System.Diagnostics.Process GetProcessById(int processId, string machineName) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Diagnostics.Process[] GetProcesses() { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Diagnostics.Process[] GetProcesses(string machineName) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Diagnostics.Process[] GetProcessesByName(string? processName) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static System.Diagnostics.Process[] GetProcessesByName(string? processName, string machineName) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] @@ -233,6 +245,8 @@ internal ProcessThread() { } public int IdealProcessor { set { } } public bool PriorityBoostEnabled { get { throw null; } set { } } public System.Diagnostics.ThreadPriorityLevel PriorityLevel { [System.Runtime.Versioning.SupportedOSPlatform("windows")] [System.Runtime.Versioning.SupportedOSPlatform("linux")] [System.Runtime.Versioning.SupportedOSPlatform("freebsd")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public System.TimeSpan PrivilegedProcessorTime { get { throw null; } } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public System.IntPtr ProcessorAffinity { set { } } @@ -241,7 +255,11 @@ public System.IntPtr ProcessorAffinity { set { } } [System.Runtime.Versioning.SupportedOSPlatform("linux")] public System.DateTime StartTime { get { throw null; } } public System.Diagnostics.ThreadState ThreadState { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public System.TimeSpan TotalProcessorTime { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public System.TimeSpan UserProcessorTime { get { throw null; } } public System.Diagnostics.ThreadWaitReason WaitReason { get { throw null; } } public void ResetIdealProcessor() { } diff --git a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj index 1bf0c43270e42e..6bdd9f8d69db27 100644 --- a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj +++ b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj @@ -309,7 +309,7 @@ - + @@ -329,7 +329,7 @@ - + @@ -345,6 +345,11 @@ + + + + + diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.BSD.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.BSD.cs index 02b7cce02263d6..3380481ca5c8e3 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.BSD.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.BSD.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.Versioning; namespace System.Diagnostics { @@ -12,6 +13,8 @@ public partial class Process /// Creates an array of components that are associated with process resources on a /// remote computer. These process resources share the specified process name. /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static Process[] GetProcessesByName(string? processName, string machineName) { if (processName == null) diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs index 6942d82d6d1595..016327ad61ab57 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs @@ -7,6 +7,7 @@ using System.ComponentModel; using System.Globalization; using System.IO; +using System.Runtime.Versioning; using System.Text; namespace System.Diagnostics @@ -17,6 +18,8 @@ public partial class Process : IDisposable /// Creates an array of components that are associated with process resources on a /// remote computer. These process resources share the specified process name. /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static Process[] GetProcessesByName(string? processName, string machineName) { ProcessManager.ThrowIfRemoteMachine(machineName); diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.UnknownUnix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.UnknownUnix.cs index 46c652a7fb6a69..897fde77e9a75d 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.UnknownUnix.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.UnknownUnix.cs @@ -9,7 +9,7 @@ public partial class Process : IDisposable /// Creates an array of components that are associated with process resources on a /// remote computer. These process resources share the specified process name. /// - public static Process[] GetProcessesByName(string processName, string machineName) + public static Process[] GetProcessesByName(string? processName, string machineName) { throw new PlatformNotSupportedException(); } @@ -82,5 +82,6 @@ private string GetPathToOpenFile() throw new PlatformNotSupportedException(); } + private int ParentProcessId => throw new PlatformNotSupportedException(); } } 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 9c59f54333bf64..ad7209a3f198d2 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 @@ -21,6 +21,8 @@ public partial class Process : IDisposable /// Creates an array of components that are associated with process resources on a /// remote computer. These process resources share the specified process name. /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static Process[] GetProcessesByName(string? processName, string machineName) { if (processName == null) 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 0c5bf3a96542ae..fe99dd2786bbab 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs @@ -193,6 +193,8 @@ public bool HasExited } /// Gets the time the associated process was started. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public DateTime StartTime { get @@ -1039,6 +1041,8 @@ public static Process GetProcessById(int processId) /// local computer. These process resources share the specified process name. /// /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static Process[] GetProcessesByName(string? processName) { return GetProcessesByName(processName, "."); @@ -1050,6 +1054,8 @@ public static Process[] GetProcessesByName(string? processName) /// component for each process resource on the local computer. /// /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static Process[] GetProcesses() { return GetProcesses("."); @@ -1062,6 +1068,8 @@ public static Process[] GetProcesses() /// process resource on the specified computer. /// /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static Process[] GetProcesses(string machineName) { bool isRemoteMachine = ProcessManager.IsRemoteMachine(machineName); diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.iOS.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.iOS.cs new file mode 100644 index 00000000000000..e3fa89f34ccd1c --- /dev/null +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.iOS.cs @@ -0,0 +1,122 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +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) + { + throw new PlatformNotSupportedException(); + } + + /// + /// Creates an array of components that are associated with process resources on a + /// remote computer. These process resources share the specified process name. + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public static Process[] GetProcessesByName(string? processName, string machineName) + { + throw new PlatformNotSupportedException(); + } + + /// Gets the amount of time the process has spent running code inside the operating system core. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan PrivilegedProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + + /// Gets the time the associated process was started. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + internal DateTime StartTimeCore + { + get { throw new PlatformNotSupportedException(); } + } + + /// + /// Gets the amount of time the associated process has spent utilizing the CPU. + /// It is the sum of the and + /// . + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan TotalProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + + /// + /// Gets the amount of time the associated process has spent running code + /// inside the application portion of the process (not the operating system core). + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan UserProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + + /// + /// Returns all immediate child processes. + /// + private IReadOnlyList GetChildProcesses(Process[]? processes = null) + { + throw new PlatformNotSupportedException(); + } + + /// Gets parent process ID + private int GetParentProcessId => + throw new PlatformNotSupportedException(); + + /// + /// Gets or sets which processors the threads in this process can be scheduled to run on. + /// + private IntPtr ProcessorAffinityCore + { + get { throw new PlatformNotSupportedException(); } + set { throw new PlatformNotSupportedException(); } + } + + /// + /// Make sure we have obtained the min and max working set limits. + /// + private void GetWorkingSetLimits(out IntPtr minWorkingSet, out IntPtr maxWorkingSet) + { + throw new PlatformNotSupportedException(); + } + + /// Sets one or both of the minimum and maximum working set limits. + /// The new minimum working set limit, or null not to change it. + /// The new maximum working set limit, or null not to change it. + /// The resulting minimum working set limit after any changes applied. + /// The resulting maximum working set limit after any changes applied. + private void SetWorkingSetLimitsCore(IntPtr? newMin, IntPtr? newMax, out IntPtr resultingMin, out IntPtr resultingMax) + { + throw new PlatformNotSupportedException(); + } + + /// Gets execution path + private string GetPathToOpenFile() + { + throw new PlatformNotSupportedException(); + } + + private int ParentProcessId => throw new PlatformNotSupportedException(); + + private static bool IsProcessInvalidException(Exception e) => + // InvalidOperationException signifies conditions such as the process already being dead. + // Win32Exception signifies issues such as insufficient permissions to get details on the process. + // In either case, the predicate couldn't be applied so return the fallback result. + e is InvalidOperationException || e is Win32Exception; + } +} diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Unix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Unix.cs index 5df7ece329e1d3..d9e27a8c542769 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Unix.cs @@ -3,6 +3,7 @@ using Microsoft.Win32.SafeHandles; using System.Collections.Generic; +using System.Runtime.Versioning; using System.Text; namespace System.Diagnostics @@ -44,6 +45,8 @@ public static bool IsProcessRunning(int processId) /// Gets the IDs of all processes on the specified machine. /// The machine to examine. /// An array of process IDs from the specified machine. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static int[] GetProcessIds(string machineName) { ThrowIfRemoteMachine(machineName); diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.iOS.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.iOS.cs new file mode 100644 index 00000000000000..2fddb3b200e7e3 --- /dev/null +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.iOS.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.Versioning; + +namespace System.Diagnostics +{ + internal static partial class ProcessManager + { + /// Gets the IDs of all processes on the current machine. + public static int[] GetProcessIds() + { + throw new PlatformNotSupportedException(); + } + + /// Gets process infos for each process on the specified machine. + /// The target machine. + /// An array of process infos, one per found process. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public static ProcessInfo[] GetProcessInfos(string machineName) + { + throw new PlatformNotSupportedException(); + } + + /// Gets an array of module infos for the specified process. + /// The ID of the process whose modules should be enumerated. + /// The array of modules. + internal static ProcessModuleCollection GetModules(int processId) + { + return new ProcessModuleCollection(0); + } + + private static ProcessInfo CreateProcessInfo(int pid) + { + throw new PlatformNotSupportedException(); + } + } +} diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.iOS.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.iOS.cs new file mode 100644 index 00000000000000..8faa430900aabf --- /dev/null +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.iOS.cs @@ -0,0 +1,56 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.Versioning; + +namespace System.Diagnostics +{ + public partial class ProcessThread + { + /// + /// Returns or sets the priority level of the associated thread. The priority level is + /// not an absolute level, but instead contributes to the actual thread priority by + /// considering the priority class of the process. + /// + private ThreadPriorityLevel PriorityLevelCore + { + get { throw new PlatformNotSupportedException(); } + set { throw new PlatformNotSupportedException(); } + } + + /// + /// Returns the amount of time the thread has spent running code inside the operating + /// system core. + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan PrivilegedProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + + private DateTime GetStartTime() => throw new PlatformNotSupportedException(); + /// + /// Returns the amount of time the associated thread has spent utilizing the CPU. + /// It is the sum of the System.Diagnostics.ProcessThread.UserProcessorTime and + /// System.Diagnostics.ProcessThread.PrivilegedProcessorTime. + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan TotalProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + + /// + /// Returns the amount of time the associated thread has spent running code + /// inside the application (not the operating system core). + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan UserProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + } +} diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ThreadInfo.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ThreadInfo.cs index c12c143e5a53a1..1205e732e67328 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ThreadInfo.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ThreadInfo.cs @@ -12,6 +12,7 @@ namespace System.Diagnostics /// internal sealed class ThreadInfo { +#pragma warning disable CS0649 // The fields are unused on iOS/tvOS as the respective managed logic (mostly around libproc) is excluded. internal ulong _threadId; internal int _processId; internal int _basePriority; @@ -19,5 +20,6 @@ internal sealed class ThreadInfo internal IntPtr _startAddress; internal ThreadState _threadState; internal ThreadWaitReason _threadWaitReason; +#pragma warning restore CS0649 } } diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessModuleTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessModuleTests.cs index 33f84717da7198..fd4e9d2751753f 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessModuleTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessModuleTests.cs @@ -10,6 +10,7 @@ namespace System.Diagnostics.Tests public partial class ProcessModuleTests : ProcessTestBase { [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TestModuleProperties() { ProcessModuleCollection modules = Process.GetCurrentProcess().Modules; @@ -29,6 +30,7 @@ public void TestModuleProperties() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void Modules_Get_ContainsHostFileName() { ProcessModuleCollection modules = Process.GetCurrentProcess().Modules; diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs index 880da43a646539..19a88989696208 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs @@ -414,6 +414,7 @@ public void TestExitTime() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void StartTime_GetNotStarted_ThrowsInvalidOperationException() { var process = new Process(); @@ -525,6 +526,7 @@ public void MachineName_GetNotStarted_ThrowsInvalidOperationException() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TestMainModule() { Process p = Process.GetCurrentProcess(); @@ -854,6 +856,7 @@ public void TotalProcessorTime_PerformLoop_TotalProcessorTimeValid() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void UserProcessorTime_GetNotStarted_ThrowsInvalidOperationException() { var process = new Process(); @@ -861,6 +864,7 @@ public void UserProcessorTime_GetNotStarted_ThrowsInvalidOperationException() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void PriviledgedProcessorTime_GetNotStarted_ThrowsInvalidOperationException() { var process = new Process(); @@ -868,6 +872,7 @@ public void PriviledgedProcessorTime_GetNotStarted_ThrowsInvalidOperationExcepti } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TotalProcessorTime_GetNotStarted_ThrowsInvalidOperationException() { var process = new Process(); @@ -1105,6 +1110,7 @@ public void TestGetProcessById() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TestGetProcesses() { Process currentProcess = Process.GetCurrentProcess(); @@ -1170,6 +1176,7 @@ public void GetProcesses_RemoteMachinePath_ReturnsExpected() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void GetProcessesByName_ProcessName_ReturnsExpected() { // Get the current process using its name @@ -1229,6 +1236,7 @@ public static IEnumerable MachineName_Remote_TestData() [Theory] [MemberData(nameof(MachineName_TestData))] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void GetProcessesByName_ProcessNameMachineName_ReturnsExpected(string machineName) { Process currentProcess = Process.GetCurrentProcess(); @@ -1255,6 +1263,7 @@ public void GetProcessesByName_RemoteMachineNameWindows_ReturnsExpected(string m } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void GetProcessesByName_NoSuchProcess_ReturnsEmpty() { string processName = Guid.NewGuid().ToString("N"); @@ -1262,6 +1271,7 @@ public void GetProcessesByName_NoSuchProcess_ReturnsEmpty() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void GetProcessesByName_NullMachineName_ThrowsArgumentNullException() { Process currentProcess = Process.GetCurrentProcess(); @@ -1269,6 +1279,7 @@ public void GetProcessesByName_NullMachineName_ThrowsArgumentNullException() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void GetProcessesByName_EmptyMachineName_ThrowsArgumentException() { Process currentProcess = Process.GetCurrentProcess(); @@ -1331,6 +1342,7 @@ public void StartInfo_SetOnRunningProcess_ThrowsInvalidOperationException() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void StartInfo_SetGet_ReturnsExpected() { var process = new Process() { StartInfo = new ProcessStartInfo(RemoteExecutor.HostRunner) }; @@ -1715,6 +1727,7 @@ public void MainWindowTitle_GetWithGui_ShouldRefresh_Windows() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void RefreshResetsAllRefreshableFields() { // testing Process.Responding using a real unresponsive process would be very hard to do properly @@ -2271,6 +2284,7 @@ public void BothArgumentSetAndArgumentListSet() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void Kill_EntireProcessTree_True_ProcessNotStarted_ThrowsInvalidOperationException() { var process = new Process(); @@ -2300,6 +2314,7 @@ public void Kill_EntireProcessTree_True_CalledByNonLocalProcess_ThrowsInvalidOpe } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void Kill_EntireProcessTree_True_CalledOnCallingProcess_ThrowsInvalidOperationException() { var process = Process.GetCurrentProcess(); diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs index 2266582ac5190f..6db4fd1a2cdeea 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs @@ -46,6 +46,7 @@ public void TestCommonPriorityAndTimeProperties() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TestThreadCount() { int numOfThreads = 10; @@ -161,6 +162,7 @@ await Task.Factory.StartNew(() => } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TestStartAddressProperty() { using (Process p = Process.GetCurrentProcess()) diff --git a/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs b/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs index 418e7b04d952f0..d00e72ce7c12b7 100644 --- a/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs +++ b/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs @@ -12,6 +12,7 @@ namespace System.Diagnostics.TextWriterTraceListenerTests { + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public class XmlWriterTraceListenerTests : FileCleanupTestBase { private readonly string _processName; diff --git a/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs index e9fe758b834f7b..8c9e00887b1ad3 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs @@ -379,7 +379,7 @@ public void ReflectionOnlyGetAssemblies() } [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Throws PNSE")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "Throws PNSE")] public void MonitoringIsEnabled() { Assert.True(AppDomain.MonitoringIsEnabled); diff --git a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs index 63723f0117a099..415cafb9f02c25 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs @@ -96,6 +96,7 @@ public void ProcessPath_Idempotent() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Throws PNSE")] public void ProcessPath_MatchesExpectedValue() { string expectedProcessPath = PlatformDetection.IsBrowser ? null : Process.GetCurrentProcess().MainModule.FileName; diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 8c0fc9060c28ac..6bf5073dbfdee3 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -147,6 +147,11 @@ + + + + +