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 910193c4ed0d5..3221043e6b5ea 100644
--- a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
+++ b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
@@ -71,6 +71,8 @@ public Process() { }
public long PrivateMemorySize64 { get { throw null; } }
public System.TimeSpan PrivilegedProcessorTime { get { throw null; } }
public string ProcessName { get { throw null; } }
+ [System.Runtime.Versioning.SupportedOSPlatform("windows")]
+ [System.Runtime.Versioning.SupportedOSPlatform("linux")]
public System.IntPtr ProcessorAffinity { get { throw null; } set { } }
public bool Responding { get { throw null; } }
public Microsoft.Win32.SafeHandles.SafeProcessHandle SafeHandle { get { throw null; } }
@@ -237,11 +239,13 @@ internal ProcessThread() { }
public int Id { get { throw null; } }
public int IdealProcessor { set { } }
public bool PriorityBoostEnabled { get { throw null; } set { } }
- public System.Diagnostics.ThreadPriorityLevel PriorityLevel { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] 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 { } }
public System.TimeSpan PrivilegedProcessorTime { get { throw null; } }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public System.IntPtr ProcessorAffinity { set { } }
public System.IntPtr StartAddress { get { throw null; } }
+ [System.Runtime.Versioning.SupportedOSPlatform("windows")]
+ [System.Runtime.Versioning.SupportedOSPlatform("linux")]
public System.DateTime StartTime { get { throw null; } }
public System.Diagnostics.ThreadState ThreadState { get { throw null; } }
public System.TimeSpan TotalProcessorTime { get { throw 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 f0eb46b0f67e0..58d297728f5ca 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs
@@ -526,6 +526,8 @@ public string ProcessName
/// or sets which processors the threads in this process can be scheduled to run on.
///
///
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("linux")]
public IntPtr ProcessorAffinity
{
get
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 a4b1e171768af..5df7ece329e1d 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
@@ -72,9 +72,5 @@ internal static void ThrowIfRemoteMachine(string machineName)
throw new PlatformNotSupportedException(SR.RemoteMachinesNotSupported);
}
}
- public static IntPtr GetMainWindowHandle(int processId)
- {
- throw new PlatformNotSupportedException(); // Window handle is a Windows concept
- }
}
}
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.FreeBSD.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.FreeBSD.cs
index cf098ac0ef0ce..a6b17bee36fb5 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.FreeBSD.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.FreeBSD.cs
@@ -23,13 +23,9 @@ private ThreadPriorityLevel PriorityLevelCore
}
}
- /// Returns the time the associated thread was started.
- public DateTime StartTime
- {
- // kinfo_proc has one entry per thread but ki_start seems to be same for
- // all threads e.g. reflects process start. This may be re-visited later.
- get { throw new PlatformNotSupportedException(); }
- }
+ // kinfo_proc has one entry per thread but ki_start seems to be same for
+ // all threads e.g. reflects process start. This may be re-visited later.
+ private DateTime GetStartTime() => throw new PlatformNotSupportedException();
///
/// Returns the amount of time the associated thread has spent utilizing the CPU.
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Linux.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Linux.cs
index 3a0f2342b3544..853c06dcdfa2c 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Linux.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Linux.cs
@@ -41,11 +41,7 @@ public TimeSpan PrivilegedProcessorTime
}
}
- /// Returns the time the associated thread was started.
- public DateTime StartTime
- {
- get { return Process.BootTimeToDateTime(Process.TicksToTimeSpan(GetStat().starttime)); }
- }
+ private DateTime GetStartTime() => Process.BootTimeToDateTime(Process.TicksToTimeSpan(GetStat().starttime));
///
/// Returns the amount of time the associated thread has spent utilizing the CPU.
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.OSX.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.OSX.cs
index eca275a352e04..e95abff9af741 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.OSX.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.OSX.cs
@@ -25,11 +25,7 @@ private ThreadPriorityLevel PriorityLevelCore
///
public TimeSpan PrivilegedProcessorTime => new TimeSpan((long)GetThreadInfo().pth_system_time);
- /// Returns the time the associated thread was started.
- public DateTime StartTime
- {
- get { throw new PlatformNotSupportedException(); } // macOS does not provide a way to get this data
- }
+ private DateTime GetStartTime() => throw new PlatformNotSupportedException(); // macOS does not provide a way to get this data
///
/// Returns the amount of time the associated thread has spent using the CPU.
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.UnknownUnix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.UnknownUnix.cs
index 8754ffdf5e531..6d947625ddd6b 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.UnknownUnix.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.UnknownUnix.cs
@@ -25,11 +25,7 @@ public TimeSpan PrivilegedProcessorTime
get { throw new PlatformNotSupportedException(); } // Not available on POSIX
}
- /// Returns the time the associated thread was started.
- public DateTime StartTime
- {
- get { throw new PlatformNotSupportedException(); } // Not available on POSIX
- }
+ private DateTime GetStartTime() => throw new PlatformNotSupportedException(); // Not available on POSIX
///
/// Returns the amount of time the associated thread has spent utilizing the CPU.
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Windows.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Windows.cs
index f46fd604e5e21..85c96684c2bc7 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Windows.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.Windows.cs
@@ -124,11 +124,7 @@ public TimeSpan PrivilegedProcessorTime
get { return GetThreadTimes().PrivilegedProcessorTime; }
}
- /// Returns the time the associated thread was started.
- public DateTime StartTime
- {
- get { return GetThreadTimes().StartTime; }
- }
+ private DateTime GetStartTime() => GetThreadTimes().StartTime;
///
/// Returns the amount of time the associated thread has spent utilizing the CPU.
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.cs
index e147573bc13bc..215e67e8928d5 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.cs
@@ -88,6 +88,9 @@ public bool PriorityBoostEnabled
///
public ThreadPriorityLevel PriorityLevel
{
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("linux")]
+ [SupportedOSPlatform("freebsd")]
get
{
if (!_priorityLevel.HasValue)
@@ -136,6 +139,14 @@ public ThreadWaitReason WaitReason
}
}
+ /// Returns the time the associated thread was started.
+ [SupportedOSPlatform("windows")]
+ [SupportedOSPlatform("linux")]
+ public DateTime StartTime
+ {
+ get => GetStartTime();
+ }
+
///
/// Helper to check preconditions for property access.
///