From 91c1d5cc82061e4eb1bbd1cde52cb49ac05f33c0 Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Mon, 15 Nov 2021 10:59:46 +0300 Subject: [PATCH 1/3] Exclude libroc and related on iOS/tvOS --- .../src/System.Diagnostics.Process.csproj | 17 ++++++++---- .../src/System/Diagnostics/Process.iOS.cs | 18 +++++++++++++ .../System/Diagnostics/ProcessManager.iOS.cs | 27 +++++++++++++++++++ .../System/Diagnostics/ProcessThread.iOS.cs | 18 +++++++++++++ 4 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.iOS.cs create mode 100644 src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.iOS.cs create mode 100644 src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.iOS.cs 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 b054e6f644913d..6ffb150d103a40 100644 --- a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj +++ b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj @@ -311,17 +311,24 @@ - - - - + + + + + + + + + + + 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..f7735831b15a2f --- /dev/null +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.iOS.cs @@ -0,0 +1,18 @@ +// 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; + +namespace System.Diagnostics +{ + public partial class Process + { + public TimeSpan PrivilegedProcessorTime => throw new PlatformNotSupportedException(); + public TimeSpan TotalProcessorTime => throw new PlatformNotSupportedException(); + public TimeSpan UserProcessorTime => throw new PlatformNotSupportedException(); + internal DateTime StartTimeCore => throw new PlatformNotSupportedException(); + private int ParentProcessId => throw new PlatformNotSupportedException(); + private string GetPathToOpenFile() => throw new PlatformNotSupportedException(); + } +} 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..f3347298d76559 --- /dev/null +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.iOS.cs @@ -0,0 +1,27 @@ +// 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.IO; +using System.Runtime.InteropServices; + +namespace System.Diagnostics +{ + internal static partial class ProcessManager + { + public static int[] GetProcessIds() + { + throw new PlatformNotSupportedException(); + } + + private static ProcessInfo CreateProcessInfo(int pid) + { + throw new PlatformNotSupportedException(); + } + + private static string GetProcPath(int processId) + { + 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..00adfe1f9b88ac --- /dev/null +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.iOS.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Diagnostics +{ + public partial class ProcessThread + { + public TimeSpan PrivilegedProcessorTime => throw new PlatformNotSupportedException(); + public TimeSpan TotalProcessorTime => throw new PlatformNotSupportedException(); + public TimeSpan UserProcessorTime => throw new PlatformNotSupportedException(); + private ThreadPriorityLevel PriorityLevelCore + { + get { throw new PlatformNotSupportedException(SR.ThreadPriorityNotSupported); } + set { throw new PlatformNotSupportedException(SR.ThreadPriorityNotSupported); } + } + private DateTime GetStartTime() => throw new PlatformNotSupportedException(); + } +} From 5fda426afd6cb2ca3c226d4f471bb8bed37cbfbc Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Mon, 15 Nov 2021 14:32:34 +0300 Subject: [PATCH 2/3] Use Process*.UnknownUnix.cs files to handle iOS/tvOS --- .../src/System.Diagnostics.Process.csproj | 21 +++++---------- .../System/Diagnostics/Process.UnknownUnix.cs | 3 ++- .../src/System/Diagnostics/Process.iOS.cs | 18 ------------- .../System/Diagnostics/ProcessManager.iOS.cs | 27 ------------------- .../System/Diagnostics/ProcessThread.iOS.cs | 18 ------------- 5 files changed, 9 insertions(+), 78 deletions(-) delete mode 100644 src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.iOS.cs delete mode 100644 src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.iOS.cs delete mode 100644 src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.iOS.cs 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 6ffb150d103a40..bf25b279995355 100644 --- a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj +++ b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj @@ -309,26 +309,19 @@ - + + + + + - - - - - - - - - - - @@ -352,7 +345,7 @@ - + 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.iOS.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.iOS.cs deleted file mode 100644 index f7735831b15a2f..00000000000000 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.iOS.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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; - -namespace System.Diagnostics -{ - public partial class Process - { - public TimeSpan PrivilegedProcessorTime => throw new PlatformNotSupportedException(); - public TimeSpan TotalProcessorTime => throw new PlatformNotSupportedException(); - public TimeSpan UserProcessorTime => throw new PlatformNotSupportedException(); - internal DateTime StartTimeCore => throw new PlatformNotSupportedException(); - private int ParentProcessId => throw new PlatformNotSupportedException(); - private string GetPathToOpenFile() => throw new PlatformNotSupportedException(); - } -} 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 deleted file mode 100644 index f3347298d76559..00000000000000 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.iOS.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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.IO; -using System.Runtime.InteropServices; - -namespace System.Diagnostics -{ - internal static partial class ProcessManager - { - public static int[] GetProcessIds() - { - throw new PlatformNotSupportedException(); - } - - private static ProcessInfo CreateProcessInfo(int pid) - { - throw new PlatformNotSupportedException(); - } - - private static string GetProcPath(int processId) - { - 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 deleted file mode 100644 index 00adfe1f9b88ac..00000000000000 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.iOS.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace System.Diagnostics -{ - public partial class ProcessThread - { - public TimeSpan PrivilegedProcessorTime => throw new PlatformNotSupportedException(); - public TimeSpan TotalProcessorTime => throw new PlatformNotSupportedException(); - public TimeSpan UserProcessorTime => throw new PlatformNotSupportedException(); - private ThreadPriorityLevel PriorityLevelCore - { - get { throw new PlatformNotSupportedException(SR.ThreadPriorityNotSupported); } - set { throw new PlatformNotSupportedException(SR.ThreadPriorityNotSupported); } - } - private DateTime GetStartTime() => throw new PlatformNotSupportedException(); - } -} From 544a47e21d2dd355303a4bc9f1f0743e941e5183 Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Mon, 15 Nov 2021 16:02:13 +0300 Subject: [PATCH 3/3] Ignore CS0649 on iOS/tvOS --- .../src/System.Diagnostics.Process.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 bf25b279995355..c7e947ec99cc63 100644 --- a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj +++ b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj @@ -5,7 +5,7 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS enable - $(NoWarn);0649 + $(NoWarn);0649 SR.Process_PlatformNotSupported