Fix CA1839: Use 'Environment.ProcessPath' (#15650)

This commit is contained in:
xtqqczze 2021-06-25 04:56:55 +01:00 committed by GitHub
parent 170a226689
commit 8337d2afd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -447,7 +447,7 @@ dotnet_diagnostic.CA1838.severity = silent
# CA1839: Use 'Environment.ProcessPath'
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1839
dotnet_diagnostic.CA1839.severity = suggestion
dotnet_diagnostic.CA1839.severity = warning
# CA1840: Use 'Environment.CurrentManagedThreadId'
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1840

View File

@ -64,7 +64,7 @@ namespace TestExe
for (uint i = 0; i < num; i++)
{
Process child = new Process();
child.StartInfo.FileName = Process.GetCurrentProcess().MainModule.FileName;
child.StartInfo.FileName = Environment.ProcessPath;
child.StartInfo.Arguments = "-createchildprocess";
child.Start();
}

View File

@ -115,7 +115,7 @@ namespace PSTests.Parallel
{
directoryObject = new DirectoryInfo(System.Environment.CurrentDirectory);
fileObject = new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location);
executableObject = new FileInfo(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
executableObject = new FileInfo(Environment.ProcessPath);
}
Assert.Equal("d----", FileSystemProvider.Mode(PSObject.AsPSObject(directoryObject)).Replace("r", "-"));