Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/AliasHelpInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ internal override HelpCategory HelpCategory
}
}

private PSObject _fullHelpObject;
private readonly PSObject _fullHelpObject;

/// <summary>
/// Returns full help object for alias help.
Expand Down
4 changes: 2 additions & 2 deletions src/System.Management.Automation/help/AliasHelpProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal AliasHelpProvider(HelpSystem helpSystem) : base(helpSystem)
/// of wildcard search patterns. This is currently not achievable
/// through _commandDiscovery.
/// </remarks>
private SessionState _sessionState;
private readonly SessionState _sessionState;

/// <summary>
/// Command Discovery object for current session.
Expand All @@ -50,7 +50,7 @@ internal AliasHelpProvider(HelpSystem helpSystem) : base(helpSystem)
/// The AliasInfo object returned from _commandDiscovery is essential
/// in creating AliasHelpInfo.
/// </remarks>
private CommandDiscovery _commandDiscovery;
private readonly CommandDiscovery _commandDiscovery;

#region Common Properties

Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/CabinetAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ internal abstract class ICabinetExtractorLoader
/// </summary>
internal class CabinetExtractorFactory
{
private static ICabinetExtractorLoader s_cabinetLoader;
private static readonly ICabinetExtractorLoader s_cabinetLoader;
internal static readonly ICabinetExtractor EmptyExtractor = new EmptyCabinetExtractor();

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static CommandHelpProvider()
s_engineModuleHelpFileCache.Add("Microsoft.WSMan.Management", "Microsoft.Wsman.Management.dll-Help.xml");
}

private static Dictionary<string, string> s_engineModuleHelpFileCache = new Dictionary<string, string>();
private static readonly Dictionary<string, string> s_engineModuleHelpFileCache = new Dictionary<string, string>();

private readonly ExecutionContext _context;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public ErrorRecord ErrorRecord
}
}

private string _helpCategory = System.Management.Automation.HelpCategory.None.ToString();
private readonly string _helpCategory = System.Management.Automation.HelpCategory.None.ToString();

/// <summary>
/// Gets name of the help category that is invalid.
Expand Down
4 changes: 2 additions & 2 deletions src/System.Management.Automation/help/HelpCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public GetHelpCommand()
IgnoreCase = true)]
public string[] Category { get; set; }

private string _provider = string.Empty;
private readonly string _provider = string.Empty;

/// <summary>
/// Changes the view of HelpObject returned.
Expand Down Expand Up @@ -723,7 +723,7 @@ internal static void VerifyParameterForbiddenInRemoteRunspace(Cmdlet cmdlet, str
#region trace

[TraceSourceAttribute("GetHelpCommand ", "GetHelpCommand ")]
private static PSTraceSource s_tracer = PSTraceSource.GetTracer("GetHelpCommand ", "GetHelpCommand ");
private static readonly PSTraceSource s_tracer = PSTraceSource.GetTracer("GetHelpCommand ", "GetHelpCommand ");

#endregion
}
Expand Down
8 changes: 4 additions & 4 deletions src/System.Management.Automation/help/HelpCommentsParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ private HelpCommentsParser(CommandInfo commandInfo, List<string> parameterDescri
private readonly List<string> _links = new List<string>();
internal bool isExternalHelpSet = false;

private ScriptBlock _scriptBlock;
private CommandMetadata _commandMetadata;
private string _commandName;
private List<string> _parameterDescriptions;
private readonly ScriptBlock _scriptBlock;
private readonly CommandMetadata _commandMetadata;
private readonly string _commandName;
private readonly List<string> _parameterDescriptions;
private XmlDocument _doc;
internal static readonly string mshURI = "http://msh";
internal static readonly string mamlURI = "http://schemas.microsoft.com/maml/2004/10";
Expand Down
6 changes: 3 additions & 3 deletions src/System.Management.Automation/help/HelpErrorTracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ internal class HelpErrorTracer
internal sealed class TraceFrame : IDisposable
{
// Following are help context information
private string _helpFile = string.Empty;
private readonly string _helpFile = string.Empty;

// ErrorRecords accumulated during the help content loading.
private Collection<ErrorRecord> _errors = new Collection<ErrorRecord>();
private readonly Collection<ErrorRecord> _errors = new Collection<ErrorRecord>();

private HelpErrorTracer _helpTracer;
private readonly HelpErrorTracer _helpTracer;
/// <summary>
/// Constructor. Here help context information will be collected.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/System.Management.Automation/help/HelpFileHelpInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ private HelpFileHelpInfo(string name, string text, string filename)
/// <value>Name for the help info</value>
internal override string Name { get; } = string.Empty;

private string _filename = string.Empty;
private string _synopsis = string.Empty;
private readonly string _filename = string.Empty;
private readonly string _synopsis = string.Empty;
/// <summary>
/// Synopsis for the help info.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ internal override void Reset()
///
/// This will avoid one help file getting loaded again and again.
/// </summary>
private Hashtable _helpFiles = new Hashtable();
private readonly Hashtable _helpFiles = new Hashtable();

#endregion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public ErrorRecord ErrorRecord
}
}

private string _helpTopic = string.Empty;
private readonly string _helpTopic = string.Empty;

/// <summary>
/// Gets help topic for which help is not found.
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/HelpProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal HelpProvider(HelpSystem helpSystem)
_helpSystem = helpSystem;
}

private HelpSystem _helpSystem;
private readonly HelpSystem _helpSystem;

internal HelpSystem HelpSystem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal HelpProviderWithCache(HelpSystem helpSystem) : base(helpSystem)
/// <remarks>
/// This hashtable is made case-insensitive so that helpInfo can be retrieved case insensitively.
/// </remarks>
private Hashtable _helpCache = new Hashtable(StringComparer.OrdinalIgnoreCase);
private readonly Hashtable _helpCache = new Hashtable(StringComparer.OrdinalIgnoreCase);

/// <summary>
/// Exact match help for a target.
Expand Down
6 changes: 3 additions & 3 deletions src/System.Management.Automation/help/HelpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ internal HelpSystem(ExecutionContext context)
Initialize();
}

private ExecutionContext _executionContext;
private readonly ExecutionContext _executionContext;

/// <summary>
/// ExecutionContext for the help system. Different help providers
Expand Down Expand Up @@ -173,7 +173,7 @@ internal IEnumerable<HelpInfo> GetHelp(HelpRequest helpRequest)

#region Error Handling

private Collection<ErrorRecord> _lastErrors = new Collection<ErrorRecord>();
private readonly Collection<ErrorRecord> _lastErrors = new Collection<ErrorRecord>();

/// <summary>
/// This is for tracking the last set of errors happened during the help
Expand Down Expand Up @@ -540,7 +540,7 @@ private IEnumerable<HelpInfo> SearchHelp(HelpRequest helpRequest)

#region Help Provider Manager

private ArrayList _helpProviders = new ArrayList();
private readonly ArrayList _helpProviders = new ArrayList();

/// <summary>
/// Return the list of help providers initialized.
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/MUIFileSearcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ internal Collection<string> Result
/// _uniqueMatches is used to track matches already found during the search process.
/// This is useful for ignoring duplicates in the case of unique search.
/// </summary>
private Hashtable _uniqueMatches = new Hashtable(StringComparer.OrdinalIgnoreCase);
private readonly Hashtable _uniqueMatches = new Hashtable(StringComparer.OrdinalIgnoreCase);

/// <summary>
/// Search for files using the target, searchPaths member of this class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private MamlClassHelpInfo(XmlNode xmlNode, HelpCategory helpCategory)
/// <summary>
/// PSObject representation on help.
/// </summary>
private PSObject _fullHelpObject;
private readonly PSObject _fullHelpObject;

#region Load

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ internal void OverrideProviderSpecificHelpWithGenericHelp(HelpInfo genericHelpIn

#region Basic Help Properties

private PSObject _fullHelpObject;
private readonly PSObject _fullHelpObject;

/// <summary>
/// Full help object for this help item.
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/MamlNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ internal MamlNode(XmlNode xmlNode)
_xmlNode = xmlNode;
}

private XmlNode _xmlNode;
private readonly XmlNode _xmlNode;

/// <summary>
/// Underline xmlNode for this MamlNode object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal class ProviderCommandHelpInfo : HelpInfo
/// <summary>
/// Help info.
/// </summary>
private HelpInfo _helpInfo;
private readonly HelpInfo _helpInfo;

/// <summary>
/// Constructor for ProviderCommandHelpInfo.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ internal override HelpCategory HelpCategory
}
}

private PSObject _fullHelpObject;
private readonly PSObject _fullHelpObject;

/// <summary>
/// Full help object for this provider help info.
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/RemoteHelpInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace System.Management.Automation
/// </summary>
internal class RemoteHelpInfo : BaseCommandHelpInfo
{
private PSObject _deserializedRemoteHelp;
private readonly PSObject _deserializedRemoteHelp;

internal RemoteHelpInfo(
ExecutionContext context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class UpdatableHelpCommandBase : PSCmdlet
internal bool _stopping;

internal int activityId;
private Dictionary<string, UpdatableHelpExceptionContext> _exceptions;
private readonly Dictionary<string, UpdatableHelpExceptionContext> _exceptions;

#region Parameters

Expand Down Expand Up @@ -161,7 +161,7 @@ private void HandleProgressChanged(object sender, UpdatableHelpProgressEventArgs

#region Constructor

private static Dictionary<string, string> s_metadataCache;
private static readonly Dictionary<string, string> s_metadataCache;

/// <summary>
/// Static constructor
Expand Down
14 changes: 7 additions & 7 deletions src/System.Management.Automation/help/UpdatableHelpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ internal UpdatableHelpProgressEventArgs(string moduleName, UpdatableHelpCommandT
/// </summary>
internal class UpdatableHelpSystem : IDisposable
{
private TimeSpan _defaultTimeout;
private Collection<UpdatableHelpProgressEventArgs> _progressEvents;
private readonly TimeSpan _defaultTimeout;
private readonly Collection<UpdatableHelpProgressEventArgs> _progressEvents;
private bool _stopping;
private object _syncObject;
private UpdatableHelpCommandBase _cmdlet;
private CancellationTokenSource _cancelTokenSource;
private readonly object _syncObject;
private readonly UpdatableHelpCommandBase _cmdlet;
private readonly CancellationTokenSource _cancelTokenSource;

internal WebClient WebClient { get; }

Expand Down Expand Up @@ -1579,8 +1579,8 @@ private void HandleDownloadProgressChanged(object sender, DownloadProgressChange
/// </summary>
internal class UpdatableHelpSystemDrive : IDisposable
{
private string _driveName;
private PSCmdlet _cmdlet;
private readonly string _driveName;
private readonly PSCmdlet _cmdlet;

/// <summary>
/// Gets the drive name.
Expand Down