mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Enable CA1837: Use 'Environment.ProcessId' (#14063)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1837
This commit is contained in:
1 parent
8148968546
commit
5c874207ec
7 files changed
+8
-8
No files matched your search
@@ -137,7 +137,7 @@ namespace System.Management.Automation
|
||||
{
|
||||
if (!this._processId.HasValue)
|
||||
{
|
||||
this._processId = (uint)System.Diagnostics.Process.GetCurrentProcess().Id;
|
||||
this._processId = (uint)Environment.ProcessId;
|
||||
}
|
||||
|
||||
return this._processId.Value;
|
||||
|
||||
@@ -511,7 +511,7 @@ namespace System.Management.Automation.Host
|
||||
Environment.MachineName,
|
||||
Environment.OSVersion.VersionString,
|
||||
string.Join(" ", Environment.GetCommandLineArgs()),
|
||||
System.Diagnostics.Process.GetCurrentProcess().Id,
|
||||
Environment.ProcessId,
|
||||
versionInfoFooter.ToString().TrimEnd());
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -377,7 +377,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
|
||||
private void VerifyProcess(Process process)
|
||||
{
|
||||
if (process.Id == Process.GetCurrentProcess().Id)
|
||||
if (process.Id == Environment.ProcessId)
|
||||
{
|
||||
ThrowTerminatingError(
|
||||
new ErrorRecord(
|
||||
|
||||
@@ -744,7 +744,7 @@ namespace System.Management.Automation.Remoting
|
||||
[SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Runtime.InteropServices.SafeHandle.DangerousGetHandle")]
|
||||
private void ProcessListeningThread(object state)
|
||||
{
|
||||
string processId = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture);
|
||||
string processId = Environment.ProcessId.ToString(CultureInfo.InvariantCulture);
|
||||
string appDomainName = NamedPipeUtils.GetCurrentAppDomainName();
|
||||
|
||||
// Logging.
|
||||
|
||||
Reference in new issue
Block a user