diff --git a/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs b/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs
index 12f575b5175..adc57710620 100644
--- a/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs
+++ b/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs
@@ -393,7 +393,7 @@ private bool TryFindInGAC(AssemblyName assemblyName, out string assemblyFilePath
}
// Find the assembly under 'gacRoot' and select the latest version.
- private bool FindInGac(string gacRoot, AssemblyName assemblyName, out string assemblyPath)
+ private static bool FindInGac(string gacRoot, AssemblyName assemblyName, out string assemblyPath)
{
bool assemblyFound = false;
assemblyPath = null;
@@ -430,7 +430,7 @@ private bool FindInGac(string gacRoot, AssemblyName assemblyName, out string ass
///
/// Try to get the specified assembly from cache.
///
- private bool TryGetAssemblyFromCache(AssemblyName assemblyName, out Assembly asmLoaded)
+ private static bool TryGetAssemblyFromCache(AssemblyName assemblyName, out Assembly asmLoaded)
{
if (s_assemblyCache.TryGetValue(assemblyName.Name, out asmLoaded))
{
@@ -454,7 +454,7 @@ private bool TryGetAssemblyFromCache(AssemblyName assemblyName, out Assembly asm
/// AssemblyName of the requested assembly.
/// AssemblyName of the loaded assembly.
///
- private bool IsAssemblyMatching(AssemblyName requestedAssembly, AssemblyName loadedAssembly)
+ private static bool IsAssemblyMatching(AssemblyName requestedAssembly, AssemblyName loadedAssembly)
{
//
// We use the same rules as CoreCLR loader to compare the requested assembly and loaded assembly:
@@ -501,7 +501,7 @@ private bool IsAssemblyMatching(AssemblyName requestedAssembly, AssemblyName loa
///
/// The assembly strong name of a CoreCLR Trusted_Platform_Assembly
///
- private Assembly GetTrustedPlatformAssembly(string tpaStrongName)
+ private static Assembly GetTrustedPlatformAssembly(string tpaStrongName)
{
// We always depend on the default context to load the TPAs that are recorded in
// the type catalog.
@@ -517,7 +517,7 @@ private Assembly GetTrustedPlatformAssembly(string tpaStrongName)
///
/// Throw FileLoadException.
///
- private void ThrowFileLoadException(string errorTemplate, params object[] args)
+ private static void ThrowFileLoadException(string errorTemplate, params object[] args)
{
string message = string.Format(CultureInfo.CurrentCulture, errorTemplate, args);
throw new FileLoadException(message);
@@ -526,7 +526,7 @@ private void ThrowFileLoadException(string errorTemplate, params object[] args)
///
/// Throw FileNotFoundException.
///
- private void ThrowFileNotFoundException(string errorTemplate, params object[] args)
+ private static void ThrowFileNotFoundException(string errorTemplate, params object[] args)
{
string message = string.Format(CultureInfo.CurrentCulture, errorTemplate, args);
throw new FileNotFoundException(message);
diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs
index 742f9936ea8..a7e7df0a5d7 100644
--- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs
+++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs
@@ -100,7 +100,7 @@ internal void LogEntry(XmlLoaderLoggerEntry entry)
WriteToTracer(entry);
}
- private void WriteToTracer(XmlLoaderLoggerEntry entry)
+ private static void WriteToTracer(XmlLoaderLoggerEntry entry)
{
if (entry.entryType == XmlLoaderLoggerEntry.EntryType.Error)
{
diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayResourceManagerCache.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayResourceManagerCache.cs
index 43e1d0ea6fc..fbdd1287a02 100644
--- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayResourceManagerCache.cs
+++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayResourceManagerCache.cs
@@ -176,7 +176,7 @@ internal Assembly ResolveAssemblyName(string assemblyName)
return retVal;
}
- private Assembly ResolveAssemblyNameInLoadedAssemblies(string assemblyName, bool fullName)
+ private static Assembly ResolveAssemblyNameInLoadedAssemblies(string assemblyName, bool fullName)
{
Assembly result = null;
diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataQuery.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataQuery.cs
index 9547ac1e072..60953d22c26 100644
--- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataQuery.cs
+++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataQuery.cs
@@ -219,7 +219,7 @@ private int MatchTypeIndex(string typeName, PSObject currentObject, PSPropertyEx
return BestMatchIndexUndefined;
}
- private bool MatchCondition(PSObject currentObject, PSPropertyExpression ex)
+ private static bool MatchCondition(PSObject currentObject, PSPropertyExpression ex)
{
if (ex == null)
return true;
diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs
index 90a44c848b2..b68288ff9ab 100644
--- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs
+++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs
@@ -586,7 +586,7 @@ private ControlBase LoadTableControlFromObjectModel(TableControl table, int view
///
///
///
- private void LoadHeadersSectionFromObjectModel(TableControlBody tableBody, List headers)
+ private static void LoadHeadersSectionFromObjectModel(TableControlBody tableBody, List headers)
{
foreach (TableControlColumnHeader header in headers)
{
@@ -746,7 +746,7 @@ private ExpressionToken LoadExpressionFromObjectModel(DisplayEntry displayEntry,
/// Load EntrySelectedBy (TypeName) into AppliesTo.
///
///
- private AppliesTo LoadAppliesToSectionFromObjectModel(List selectedBy, List condition)
+ private static AppliesTo LoadAppliesToSectionFromObjectModel(List selectedBy, List condition)
{
AppliesTo appliesTo = new AppliesTo();
diff --git a/src/System.Management.Automation/FormatAndOutput/common/Utilities/Mshexpression.cs b/src/System.Management.Automation/FormatAndOutput/common/Utilities/Mshexpression.cs
index 8f296b11e85..68921ddb0e8 100644
--- a/src/System.Management.Automation/FormatAndOutput/common/Utilities/Mshexpression.cs
+++ b/src/System.Management.Automation/FormatAndOutput/common/Utilities/Mshexpression.cs
@@ -354,7 +354,7 @@ private PSPropertyExpressionResult GetValue(PSObject target, bool eatExceptions)
}
}
- private PSObject IfHashtableWrapAsPSCustomObject(PSObject target, out bool wrapped)
+ private static PSObject IfHashtableWrapAsPSCustomObject(PSObject target, out bool wrapped)
{
wrapped = false;
diff --git a/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs b/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs
index 1d5bf0e26da..e72f9606e12 100644
--- a/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs
+++ b/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs
@@ -234,7 +234,7 @@ private string GetCmdletName(CommonCmdletMetadata cmdletMetadata)
return verb + "-" + noun;
}
- private string GetCmdletAttributes(CommonCmdletMetadata cmdletMetadata)
+ private static string GetCmdletAttributes(CommonCmdletMetadata cmdletMetadata)
{
// Generate the script for the Alias and Obsolete Attribute if any is declared in CDXML
StringBuilder attributes = new StringBuilder(150);
@@ -1444,7 +1444,7 @@ private void GenerateMethodParametersProcessing(
}
}
- private void GenerateIfBoundParameter(
+ private static void GenerateIfBoundParameter(
IEnumerable commonParameterSets,
IEnumerable methodParameterSets,
ParameterMetadata cmdletParameterMetadata,
@@ -1874,7 +1874,7 @@ private string GetHelpDirectiveForExternalHelp()
private void WriteCmdlet(TextWriter output, StaticCmdletMetadata staticCmdlet)
{
- string attributeString = this.GetCmdletAttributes(staticCmdlet.CmdletMetadata);
+ string attributeString = GetCmdletAttributes(staticCmdlet.CmdletMetadata);
Dictionary commonParameters = this.GetCommonParameters();
List commonParameterSets = GetCommonParameterSets(commonParameters);
@@ -1959,7 +1959,7 @@ private static void AddPassThruParameter(IDictionary
private void WriteCmdlet(TextWriter output, InstanceCmdletMetadata instanceCmdlet)
{
- string attributeString = this.GetCmdletAttributes(instanceCmdlet.CmdletMetadata);
+ string attributeString = GetCmdletAttributes(instanceCmdlet.CmdletMetadata);
Dictionary commonParameters = this.GetCommonParameters();
List commonParameterSets = GetCommonParameterSets(commonParameters);
@@ -2066,7 +2066,7 @@ private void WriteGetCmdlet(TextWriter output)
CommonCmdletMetadata cmdletMetadata = this.GetGetCmdletMetadata();
Dbg.Assert(cmdletMetadata != null, "xsd should ensure that cmdlet metadata element is always present");
CommandMetadata commandMetadata = this.GetCommandMetadata(cmdletMetadata);
- string attributeString = this.GetCmdletAttributes(cmdletMetadata);
+ string attributeString = GetCmdletAttributes(cmdletMetadata);
GetCmdletParameters getCmdletParameters = this.GetGetCmdletParameters(null);
if (!string.IsNullOrEmpty(getCmdletParameters.DefaultCmdletParameterSet))
diff --git a/src/System.Management.Automation/cimSupport/other/ciminstancetypeadapter.cs b/src/System.Management.Automation/cimSupport/other/ciminstancetypeadapter.cs
index c05ced76d20..4220c3b62bd 100644
--- a/src/System.Management.Automation/cimSupport/other/ciminstancetypeadapter.cs
+++ b/src/System.Management.Automation/cimSupport/other/ciminstancetypeadapter.cs
@@ -242,7 +242,7 @@ public override object GetPropertyValue(PSAdaptedProperty adaptedProperty)
throw new ArgumentNullException(nameof(adaptedProperty));
}
- private void AddTypeNameHierarchy(IList typeNamesWithNamespace, IList typeNamesWithoutNamespace, string namespaceName, string className)
+ private static void AddTypeNameHierarchy(IList typeNamesWithNamespace, IList typeNamesWithoutNamespace, string namespaceName, string className)
{
if (!string.IsNullOrEmpty(namespaceName))
{
@@ -258,7 +258,7 @@ private void AddTypeNameHierarchy(IList typeNamesWithNamespace, IList GetInheritanceChain(CimInstance cimInstance)
+ private static List GetInheritanceChain(CimInstance cimInstance)
{
List inheritanceChain = new List();
CimClass cimClass = cimInstance.CimClass;
diff --git a/src/System.Management.Automation/help/CommandHelpProvider.cs b/src/System.Management.Automation/help/CommandHelpProvider.cs
index 5feb3c00189..05a4e48af70 100644
--- a/src/System.Management.Automation/help/CommandHelpProvider.cs
+++ b/src/System.Management.Automation/help/CommandHelpProvider.cs
@@ -84,7 +84,7 @@ internal override HelpCategory HelpCategory
#region Help Provider Interface
- private void GetModulePaths(CommandInfo commandInfo, out string moduleName, out string moduleDir, out string nestedModulePath)
+ private static void GetModulePaths(CommandInfo commandInfo, out string moduleName, out string moduleDir, out string nestedModulePath)
{
Dbg.Assert(commandInfo != null, "Caller should verify that commandInfo != null");
@@ -132,7 +132,7 @@ private void GetModulePaths(CommandInfo commandInfo, out string moduleName, out
}
}
- private string GetHelpName(CommandInfo commandInfo)
+ private static string GetHelpName(CommandInfo commandInfo)
{
Dbg.Assert(commandInfo != null, "Caller should verify that commandInfo != null");
diff --git a/src/System.Management.Automation/help/HelpFileHelpProvider.cs b/src/System.Management.Automation/help/HelpFileHelpProvider.cs
index 36ffeb58675..8900a7167b3 100644
--- a/src/System.Management.Automation/help/HelpFileHelpProvider.cs
+++ b/src/System.Management.Automation/help/HelpFileHelpProvider.cs
@@ -268,7 +268,7 @@ internal override IEnumerable SearchHelp(HelpRequest helpRequest, bool
}
}
- private void GetModuleNameAndVersion(string psmodulePathRoot, string filePath, out string moduleName, out Version moduleVersion)
+ private static void GetModuleNameAndVersion(string psmodulePathRoot, string filePath, out string moduleName, out Version moduleVersion)
{
moduleVersion = null;
moduleName = null;
diff --git a/src/System.Management.Automation/help/MUIFileSearcher.cs b/src/System.Management.Automation/help/MUIFileSearcher.cs
index 301369959aa..bf6244fe3eb 100644
--- a/src/System.Management.Automation/help/MUIFileSearcher.cs
+++ b/src/System.Management.Automation/help/MUIFileSearcher.cs
@@ -113,7 +113,7 @@ private void SearchForFiles()
}
}
- private string[] GetFiles(string path, string pattern)
+ private static string[] GetFiles(string path, string pattern)
{
#if UNIX
// On Linux, file names are case sensitive, so we need to add
diff --git a/src/System.Management.Automation/help/MamlNode.cs b/src/System.Management.Automation/help/MamlNode.cs
index 4392dffd0ca..fe4e803a294 100644
--- a/src/System.Management.Automation/help/MamlNode.cs
+++ b/src/System.Management.Automation/help/MamlNode.cs
@@ -646,7 +646,7 @@ private PSObject[] GetMamlFormattingPSObjects(XmlNode xmlNode)
///
///
///
- private int GetParaMamlNodeCount(XmlNodeList nodes)
+ private static int GetParaMamlNodeCount(XmlNodeList nodes)
{
int i = 0;
diff --git a/src/System.Management.Automation/help/SaveHelpCommand.cs b/src/System.Management.Automation/help/SaveHelpCommand.cs
index 3c4d18af00a..7059550730b 100644
--- a/src/System.Management.Automation/help/SaveHelpCommand.cs
+++ b/src/System.Management.Automation/help/SaveHelpCommand.cs
@@ -484,7 +484,7 @@ public override object Transform(EngineIntrinsics engineIntrinsics, object input
return inputData;
}
- private bool TryConvertFromDeserializedModuleInfo(object inputData, out PSModuleInfo moduleInfo)
+ private static bool TryConvertFromDeserializedModuleInfo(object inputData, out PSModuleInfo moduleInfo)
{
moduleInfo = null;
PSObject pso = inputData as PSObject;
diff --git a/src/System.Management.Automation/help/UpdatableHelpSystem.cs b/src/System.Management.Automation/help/UpdatableHelpSystem.cs
index f7a476d5d07..d302f7b9cae 100644
--- a/src/System.Management.Automation/help/UpdatableHelpSystem.cs
+++ b/src/System.Management.Automation/help/UpdatableHelpSystem.cs
@@ -621,7 +621,7 @@ internal UpdatableHelpInfo CreateHelpInfo(string xml, string moduleName, Guid mo
/// Xml schema.
/// Validation event handler.
/// HelpInfo or HelpContent?
- private XmlDocument CreateValidXmlDocument(string xml, string ns, string schema, ValidationEventHandler handler,
+ private static XmlDocument CreateValidXmlDocument(string xml, string ns, string schema, ValidationEventHandler handler,
bool helpInfo)
{
XmlReaderSettings settings = new XmlReaderSettings();
@@ -998,7 +998,7 @@ internal void GenerateHelpInfo(string moduleName, Guid moduleGuid, string conten
/// Removes the read only attribute.
///
///
- private void RemoveReadOnly(string path)
+ private static void RemoveReadOnly(string path)
{
if (File.Exists(path))
{
@@ -1093,7 +1093,7 @@ internal void InstallHelpContent(UpdatableHelpCommandType commandType, Execution
}
#if UNIX
- private bool ExpandArchive(string source, string destination)
+ private static bool ExpandArchive(string source, string destination)
{
bool sucessfulDecompression = false;
@@ -1125,7 +1125,7 @@ private bool ExpandArchive(string source, string destination)
/// Source path.
/// Destination path.
/// Is set to false if we find a single file placeholder.txt in cab. This means we no longer need to install help files.
- private void UnzipHelpContent(ExecutionContext context, string srcPath, string destPath, out bool needToCopy)
+ private static void UnzipHelpContent(ExecutionContext context, string srcPath, string destPath, out bool needToCopy)
{
needToCopy = true;
diff --git a/src/System.Management.Automation/help/UpdateHelpCommand.cs b/src/System.Management.Automation/help/UpdateHelpCommand.cs
index 9580027e989..01b17cbad7e 100644
--- a/src/System.Management.Automation/help/UpdateHelpCommand.cs
+++ b/src/System.Management.Automation/help/UpdateHelpCommand.cs
@@ -488,7 +488,7 @@ internal override bool ProcessModuleWithCulture(UpdatableHelpModuleInfo module,
///
///
///
- private void ThrowPathMustBeValidContainersException(string path, Exception e)
+ private static void ThrowPathMustBeValidContainersException(string path, Exception e)
{
throw new UpdatableHelpSystemException("PathMustBeValidContainers",
StringUtil.Format(HelpDisplayStrings.PathMustBeValidContainers, path), ErrorCategory.InvalidArgument,
diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs
index a3acc0abb82..84a525e55dc 100644
--- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs
+++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs
@@ -709,7 +709,7 @@ private void WinMapNetworkDrive(PSDriveInfo drive)
///
///
///
- private bool IsNetworkMappedDrive(PSDriveInfo drive)
+ private static bool IsNetworkMappedDrive(PSDriveInfo drive)
{
bool shouldMapNetworkDrive = (drive != null && !string.IsNullOrEmpty(drive.Root) && PathIsNetworkPath(drive.Root)) &&
(drive.Persist || (drive.Credential != null && !drive.Credential.Equals(PSCredential.Empty)));
@@ -789,7 +789,7 @@ private PSDriveInfo WinRemoveDrive(PSDriveInfo drive)
/// PS Drive Info.
///
/// True if the drive can be persisted or else false.
- private bool IsSupportedDriveForPersistence(PSDriveInfo drive)
+ private static bool IsSupportedDriveForPersistence(PSDriveInfo drive)
{
bool isSupportedDriveForPersistence = false;
if (drive != null && !string.IsNullOrEmpty(drive.Name) && drive.Name.Length == 1)
@@ -4203,7 +4203,7 @@ private void RemoveFunctionsPSCopyFileFromRemoteSession(System.Management.Automa
SafeInvokeCommand.Invoke(ps, this, null, false);
}
- private bool ValidRemoteSessionForScripting(Runspace runspace)
+ private static bool ValidRemoteSessionForScripting(Runspace runspace)
{
if (runspace is not RemoteRunspace)
{
@@ -4768,7 +4768,7 @@ private bool CopyFileStreamToRemoteSession(FileInfo file, string destinationPath
// Returns a hash table with metadata about this file info.
//
- private Hashtable GetFileMetadata(FileInfo file)
+ private static Hashtable GetFileMetadata(FileInfo file)
{
Hashtable metadata = new Hashtable();
@@ -6137,7 +6137,7 @@ private void CopyAndDelete(DirectoryInfo directory, string destination, bool for
}
#if !UNIX
- private bool IsSameWindowsVolume(string source, string destination)
+ private static bool IsSameWindowsVolume(string source, string destination)
{
FileInfo src = new FileInfo(source);
FileInfo dest = new FileInfo(destination);
diff --git a/src/System.Management.Automation/namespaces/LocationGlobber.cs b/src/System.Management.Automation/namespaces/LocationGlobber.cs
index 1282b999031..e4ab1f3cfc5 100644
--- a/src/System.Management.Automation/namespaces/LocationGlobber.cs
+++ b/src/System.Management.Automation/namespaces/LocationGlobber.cs
@@ -2272,7 +2272,7 @@ internal string GenerateRelativePath(
return driveRootRelativeWorkingPath;
}
- private bool HasRelativePathTokens(string path)
+ private static bool HasRelativePathTokens(string path)
{
string comparePath = path.Replace('/', '\\');
diff --git a/src/System.Management.Automation/namespaces/RegistryProvider.cs b/src/System.Management.Automation/namespaces/RegistryProvider.cs
index 29e37a163e4..1898c960620 100644
--- a/src/System.Management.Automation/namespaces/RegistryProvider.cs
+++ b/src/System.Management.Automation/namespaces/RegistryProvider.cs
@@ -2956,7 +2956,7 @@ private string NormalizePath(string path)
return result;
}
- private bool HasRelativePathTokens(string path)
+ private static bool HasRelativePathTokens(string path)
{
return (
path.StartsWith('\\') ||
@@ -3195,7 +3195,7 @@ private object ResetRegistryKeyValue(IRegistryWrapper key, string valueName)
///
/// true if the path is empty, a \ or a /, else false
///
- private bool IsHiveContainer(string path)
+ private static bool IsHiveContainer(string path)
{
bool result = false;
if (path == null)
@@ -4114,7 +4114,7 @@ private bool ParseKind(string type, out RegistryValueKind kind)
///
/// A string containing the default value name.
///
- private string LocalizedDefaultToken => "(default)";
+ private static string LocalizedDefaultToken => "(default)";
///
/// Converts an empty or null userEnteredPropertyName to the localized
diff --git a/src/System.Management.Automation/security/SecurityManager.cs b/src/System.Management.Automation/security/SecurityManager.cs
index 1de51558040..1b554ad3940 100644
--- a/src/System.Management.Automation/security/SecurityManager.cs
+++ b/src/System.Management.Automation/security/SecurityManager.cs
@@ -368,7 +368,7 @@ private bool CheckPolicy(ExternalScriptInfo script, PSHost host, out Exception r
return policyCheckPassed;
}
- private bool SetPolicyFromAuthenticodePrompt(string path, PSHost host, ref Exception reason, Signature signature)
+ private static bool SetPolicyFromAuthenticodePrompt(string path, PSHost host, ref Exception reason, Signature signature)
{
bool policyCheckPassed = false;
@@ -405,7 +405,7 @@ private bool SetPolicyFromAuthenticodePrompt(string path, PSHost host, ref Excep
return policyCheckPassed;
}
- private bool IsLocalFile(string filename)
+ private static bool IsLocalFile(string filename)
{
#if UNIX
return true;
@@ -425,7 +425,7 @@ private bool IsLocalFile(string filename)
// Checks that a publisher is trusted by the system or is one of
// the signed product binaries
- private bool IsTrustedPublisher(Signature signature, string file)
+ private static bool IsTrustedPublisher(Signature signature, string file)
{
// Get the thumbprint of the current signature
X509Certificate2 signerCertificate = signature.SignerCertificate;
@@ -444,7 +444,7 @@ private bool IsTrustedPublisher(Signature signature, string file)
return false;
}
- private bool IsUntrustedPublisher(Signature signature, string file)
+ private static bool IsUntrustedPublisher(Signature signature, string file)
{
// Get the thumbprint of the current signature
X509Certificate2 signerCertificate = signature.SignerCertificate;
@@ -467,7 +467,7 @@ private bool IsUntrustedPublisher(Signature signature, string file)
/// Trust a publisher by adding it to the "Trusted Publishers" store.
///
///
- private void TrustPublisher(Signature signature)
+ private static void TrustPublisher(Signature signature)
{
// Get the certificate of the signer
X509Certificate2 signerCertificate = signature.SignerCertificate;
@@ -485,7 +485,7 @@ private void TrustPublisher(Signature signature)
}
}
- private void UntrustPublisher(Signature signature)
+ private static void UntrustPublisher(Signature signature)
{
// Get the certificate of the signer
X509Certificate2 signerCertificate = signature.SignerCertificate;
@@ -516,7 +516,7 @@ private void UntrustPublisher(Signature signature)
}
}
- private Signature GetSignatureWithEncodingRetry(string path, ExternalScriptInfo script)
+ private static Signature GetSignatureWithEncodingRetry(string path, ExternalScriptInfo script)
{
string verificationContents = System.Text.Encoding.Unicode.GetString(script.OriginalEncoding.GetPreamble()) + script.ScriptContents;
Signature signature = SignatureHelper.GetSignature(path, verificationContents);
@@ -640,7 +640,7 @@ protected internal override bool ShouldRun(CommandInfo commandInfo,
return allowRun;
}
- private RunPromptDecision AuthenticodePrompt(string path,
+ private static RunPromptDecision AuthenticodePrompt(string path,
Signature signature,
PSHost host)
{
@@ -713,7 +713,7 @@ private RunPromptDecision AuthenticodePrompt(string path,
return decision;
}
- private RunPromptDecision RemoteFilePrompt(string path, PSHost host)
+ private static RunPromptDecision RemoteFilePrompt(string path, PSHost host)
{
if ((host == null) || (host.UI == null))
{
@@ -743,7 +743,7 @@ private RunPromptDecision RemoteFilePrompt(string path, PSHost host)
}
}
- private Collection GetAuthenticodePromptChoices()
+ private static Collection GetAuthenticodePromptChoices()
{
Collection choices = new Collection();
@@ -764,7 +764,7 @@ private Collection GetAuthenticodePromptChoices()
return choices;
}
- private Collection GetRemoteFilePromptChoices()
+ private static Collection GetRemoteFilePromptChoices()
{
Collection choices = new Collection();
diff --git a/src/System.Management.Automation/utils/ObjectReader.cs b/src/System.Management.Automation/utils/ObjectReader.cs
index ccbc176406b..f06243ddd5b 100644
--- a/src/System.Management.Automation/utils/ObjectReader.cs
+++ b/src/System.Management.Automation/utils/ObjectReader.cs
@@ -617,7 +617,7 @@ protected override void Dispose(bool disposing)
}
}
- private ReturnType ConvertToReturnType(object inputObject)
+ private static ReturnType ConvertToReturnType(object inputObject)
{
Type resultType = typeof(ReturnType);
if (typeof(PSObject) == resultType || typeof(object) == resultType)
@@ -793,7 +793,7 @@ public override ReturnType Peek()
///
/// Input object to convert.
/// Input object converted to the specified return type.
- private ReturnType ConvertToReturnType(object inputObject)
+ private static ReturnType ConvertToReturnType(object inputObject)
{
Type resultType = typeof(ReturnType);
if (typeof(PSObject) == resultType || typeof(object) == resultType)
diff --git a/src/System.Management.Automation/utils/PowerShellETWTracer.cs b/src/System.Management.Automation/utils/PowerShellETWTracer.cs
index 7631d760b2d..e7172cfd666 100644
--- a/src/System.Management.Automation/utils/PowerShellETWTracer.cs
+++ b/src/System.Management.Automation/utils/PowerShellETWTracer.cs
@@ -988,7 +988,7 @@ public void Dispose()
///
public PowerShellTraceTask Task { get; set; } = PowerShellTraceTask.None;
- private bool IsEtwSupported
+ private static bool IsEtwSupported
{
get
{