Skip to content
Closed
2 changes: 1 addition & 1 deletion .globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ dotnet_diagnostic.CA1821.severity = warning
# CA1822: Mark members as static
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822
dotnet_diagnostic.CA1822.severity = warning
dotnet_code_quality.CA1822.api_surface = private
dotnet_code_quality.CA1822.api_surface = private, internal

# CA1823: Avoid unused private fields
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1823
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ internal PSObject AddObjectToCache(
/// </para>
/// </summary>
/// <param name="psObject"></param>
internal string GetRemoveSessionObjectTarget(PSObject psObject)
internal static string GetRemoveSessionObjectTarget(PSObject psObject)
{
string message = string.Empty;
if (psObject.BaseObject is CimSession)
Expand Down Expand Up @@ -1192,7 +1192,7 @@ public void RemoveCimSession(RemoveCimSessionCommand cmdlet)
{
foreach (PSObject psobject in sessionToRemove)
{
if (cmdlet.ShouldProcess(this.sessionState.GetRemoveSessionObjectTarget(psobject), RemoveCimSessionActionName))
if (cmdlet.ShouldProcess(CimSessionState.GetRemoveSessionObjectTarget(psobject), RemoveCimSessionActionName))
{
this.sessionState.RemoveOneSessionObjectFromCache(psobject);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ private void ProcessListSetPerMachine(string machine)
categoryType = PerformanceCounterCategoryType.SingleInstance;
}

string setHelp = _pdhHelper.GetCounterSetHelp(machine, counterSet);
string setHelp = PdhHelper.GetCounterSetHelp(machine, counterSet);

CounterSet setObj = new(counterSet, machine, categoryType, setHelp, ref counterInstanceMapping);
WriteObject(setObj);
Expand Down Expand Up @@ -422,7 +422,7 @@ private void ProcessGetCounter()
string localizedPath = path;
if (_defaultCounters)
{
res = _pdhHelper.TranslateLocalCounterPath(path, out localizedPath);
res = PdhHelper.TranslateLocalCounterPath(path, out localizedPath);
if (res != PdhResults.PDH_CSTATUS_VALID_DATA)
{
string msg = string.Format(CultureInfo.CurrentCulture, _resourceMgr.GetString("CounterPathTranslationFailed"), res);
Expand Down
6 changes: 3 additions & 3 deletions src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ private static uint ParsePath(string fullPath, ref PDH_COUNTER_PATH_ELEMENTS pCo
// requires a different firewall exception.
// This function checks and Asserts if the path is not valid.
//
public uint TranslateLocalCounterPath(string englishPath, out string localizedPath)
public static uint TranslateLocalCounterPath(string englishPath, out string localizedPath)
{
uint res = PdhResults.PDH_CSTATUS_VALID_DATA;
localizedPath = string.Empty;
Expand Down Expand Up @@ -1016,7 +1016,7 @@ public uint TranslateLocalCounterPath(string englishPath, out string localizedPa
return res;
}

public uint LookupPerfNameByIndex(string machineName, uint index, out string locName)
public static uint LookupPerfNameByIndex(string machineName, uint index, out string locName)
{
//
// NOTE: to make PdhLookupPerfNameByIndex() work,
Expand Down Expand Up @@ -1133,7 +1133,7 @@ public uint AddCounters(ref StringCollection validPaths, bool bFlushOldCounters)
return bAtLeastOneAdded ? PdhResults.PDH_CSTATUS_VALID_DATA : res;
}

public string GetCounterSetHelp(string szMachineName, string szObjectName)
public static string GetCounterSetHelp(string szMachineName, string szObjectName)
{
// API not available to retrieve
return string.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public ServiceController[] InputObject

private ServiceController[] _allServices;

internal ServiceController GetOneService(string nameOfService)
internal static ServiceController GetOneService(string nameOfService)
{
Dbg.Assert(!WildcardPattern.ContainsWildcardCharacters(nameOfService), "Caller should verify that nameOfService doesn't contain wildcard characters");

Expand Down Expand Up @@ -1085,7 +1085,7 @@ private static bool HaveAllDependentServicesStopped(ServiceController[] dependen
/// This removes all services that are not stopped from a list of services.
/// </summary>
/// <param name="services">A list of services.</param>
internal void RemoveNotStoppedServices(List<ServiceController> services)
internal static void RemoveNotStoppedServices(List<ServiceController> services)
{
// You shall not modify a collection during enumeration.
services.RemoveAll(service =>
Expand Down
Loading