Skip to content

Commit 1477734

Browse files
committed
Fix MaxWorkingSet_GetNotStarted_ThrowsInvalidOperationException
Fixes issue #105422
1 parent 3467852 commit 1477734

File tree

1 file changed

+4
-0
lines changed
  • src/libraries/System.Diagnostics.Process/src/System/Diagnostics

1 file changed

+4
-0
lines changed

src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.BSD.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ private static IntPtr ProcessorAffinityCore
5757
/// </summary>
5858
private void GetWorkingSetLimits(out IntPtr minWorkingSet, out IntPtr maxWorkingSet)
5959
{
60+
EnsureState(State.HaveNonExitedId);
61+
6062
// We can only do this for the current process on OS X
6163
if (_processId != Environment.ProcessId)
6264
throw new PlatformNotSupportedException(SR.OsxExternalProcessWorkingSetNotSupported);
@@ -86,6 +88,8 @@ private void GetWorkingSetLimits(out IntPtr minWorkingSet, out IntPtr maxWorking
8688
/// <param name="resultingMax">The resulting maximum working set limit after any changes applied.</param>
8789
private void SetWorkingSetLimitsCore(IntPtr? newMin, IntPtr? newMax, out IntPtr resultingMin, out IntPtr resultingMax)
8890
{
91+
EnsureState(State.HaveNonExitedId);
92+
8993
// We can only do this for the current process on OS X
9094
if (_processId != Environment.ProcessId)
9195
throw new PlatformNotSupportedException(SR.OsxExternalProcessWorkingSetNotSupported);

0 commit comments

Comments
 (0)