Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -434,14 +434,5 @@ private SafeWaitHandle GetSafeWaitHandle()

private static bool WaitForInputIdleCore(int _ /*milliseconds*/) => throw new InvalidOperationException(SR.InputIdleUnknownError);

/// <summary>Gets the friendly name of the process.</summary>
public string ProcessName
{
get
{
EnsureState(State.HaveProcessInfo);
return _processInfo!.ProcessName;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ namespace System.Diagnostics
{
public partial class Process : IDisposable
{
private string? _processName;

private bool _haveMainWindow;
private IntPtr _mainWindowHandle;
private string? _mainWindowTitle;
Expand Down Expand Up @@ -113,7 +111,6 @@ private void RefreshCore()
_haveMainWindow = false;
_mainWindowTitle = null;
_haveResponding = false;
_processName = null;
}

/// <summary>Additional logic invoked when the Process is closed.</summary>
Expand Down Expand Up @@ -534,39 +531,6 @@ private SafeProcessHandle GetProcessHandle(int access, bool throwIfExited = true

private static ConsoleEncoding GetStandardOutputEncoding() => GetEncoding((int)Interop.Kernel32.GetConsoleOutputCP());

/// <summary>Gets the friendly name of the process.</summary>
public string ProcessName
{
get
{
if (_processName == null)
{
// If we already have the name via a populated ProcessInfo
// then use that one.
if (_processInfo?.ProcessName != null)
{
_processName = _processInfo!.ProcessName;
}
else
{
// Ensure that the process is not yet exited
EnsureState(State.HaveNonExitedId);
_processName = ProcessManager.GetProcessName(_processId, _machineName);

// Fallback to slower ProcessInfo implementation if optimized way did not return a
// process name (e.g. in case of missing permissions for Non-Admin users)
if (_processName == null)
{
EnsureState(State.HaveProcessInfo);
_processName = _processInfo!.ProcessName;
}
}
}

return _processName;
}
}

private bool StartCore(ProcessStartInfo startInfo, SafeFileHandle? stdinHandle, SafeFileHandle? stdoutHandle, SafeFileHandle? stderrHandle)
{
SafeProcessHandle startedProcess = SafeProcessHandle.StartCore(startInfo, stdinHandle, stdoutHandle, stderrHandle);
Expand Down
Loading
Loading