mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Make applicable private Guid fields readonly (#14000)
* Make applicable private Guid fields readonly * Use in-modifier for passing a readonly Guid
This commit is contained in:
@@ -45,7 +45,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
||||
}
|
||||
}
|
||||
|
||||
private Guid instanceId;
|
||||
private readonly Guid instanceId;
|
||||
|
||||
/// <summary>
|
||||
/// Name of the cimsession.
|
||||
|
||||
+1
-1
@@ -1920,7 +1920,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
#region Constructor and shared private data
|
||||
|
||||
private readonly PSSession _remoteRunspaceInfo;
|
||||
private Guid _moduleGuid;
|
||||
private readonly Guid _moduleGuid;
|
||||
private readonly InvocationInfo _invocationInfo;
|
||||
|
||||
internal ImplicitRemotingCodeGenerator(
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace System.Diagnostics.Eventing
|
||||
private long _anyKeywordMask; // Trace Enable Flags
|
||||
private long _allKeywordMask; // Match all keyword
|
||||
private int _enabled; // Enabled flag from Trace callback
|
||||
private Guid _providerId; // Control Guid
|
||||
private readonly Guid _providerId; // Control Guid
|
||||
private int _disposed; // when 1, provider has unregister
|
||||
|
||||
[ThreadStatic]
|
||||
@@ -99,7 +99,7 @@ namespace System.Diagnostics.Eventing
|
||||
|
||||
_etwCallback = new UnsafeNativeMethods.EtwEnableCallback(EtwEnableCallBack);
|
||||
|
||||
status = UnsafeNativeMethods.EventRegister(ref _providerId, _etwCallback, null, ref _regHandle);
|
||||
status = UnsafeNativeMethods.EventRegister(in _providerId, _etwCallback, null, ref _regHandle);
|
||||
if (status != 0)
|
||||
{
|
||||
throw new Win32Exception((int)status);
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ namespace System.Diagnostics.Eventing
|
||||
[DllImport(EventProviderDllName, ExactSpelling = true, EntryPoint = "EventRegister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
|
||||
[SecurityCritical]
|
||||
internal static extern unsafe uint EventRegister(
|
||||
[In] ref Guid providerId,
|
||||
[In] in Guid providerId,
|
||||
[In] EtwEnableCallback enableCallback,
|
||||
[In] void* callbackContext,
|
||||
[In][Out] ref long registrationHandle
|
||||
|
||||
@@ -1563,7 +1563,7 @@ namespace System.Management.Automation
|
||||
private readonly string _computerName;
|
||||
|
||||
/// <summary>Runspace on which the event was generated</summary>
|
||||
private Guid _runspaceId;
|
||||
private readonly Guid _runspaceId;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an event manager for the given runspace.
|
||||
|
||||
@@ -1996,7 +1996,7 @@ namespace System.Management.Automation
|
||||
/// </summary>
|
||||
internal sealed class PSInformationalBuffers
|
||||
{
|
||||
private Guid _psInstanceId;
|
||||
private readonly Guid _psInstanceId;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
|
||||
@@ -28,12 +28,12 @@ namespace System.Management.Automation.Remoting
|
||||
/// <summary>
|
||||
/// Client runspace pool id.
|
||||
/// </summary>
|
||||
private Guid _clientRunspacePoolId;
|
||||
private readonly Guid _clientRunspacePoolId;
|
||||
|
||||
/// <summary>
|
||||
/// Client power shell id.
|
||||
/// </summary>
|
||||
private Guid _clientPowerShellId;
|
||||
private readonly Guid _clientPowerShellId;
|
||||
|
||||
/// <summary>
|
||||
/// Remote host call.
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace System.Management.Automation.Remoting
|
||||
}
|
||||
|
||||
[DataMemberAttribute()]
|
||||
private Guid _runspaceID;
|
||||
private readonly Guid _runspaceID;
|
||||
|
||||
/// <summary>
|
||||
/// Error record source instance ID.
|
||||
|
||||
@@ -862,7 +862,7 @@ namespace System.Management.Automation.Internal
|
||||
|
||||
#region Private Members
|
||||
|
||||
private Guid _clientRunspacePoolId;
|
||||
private readonly Guid _clientRunspacePoolId;
|
||||
private readonly object _syncObject = new object();
|
||||
private bool _createRunspaceCalled = false;
|
||||
private Exception _closingReason;
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// Unique identifier for this state machine. Used
|
||||
/// in tracing.
|
||||
/// </summary>
|
||||
private Guid _id;
|
||||
private readonly Guid _id;
|
||||
|
||||
/// <summary>
|
||||
/// Handler to be used in cases, where setting the state is the
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace System.Management.Automation
|
||||
private PipelineStateInfo _pipelineStateInfo = new PipelineStateInfo(PipelineState.NotStarted);
|
||||
private readonly CommandCollection _commands = new CommandCollection();
|
||||
private readonly string _computerName;
|
||||
private Guid _runspaceId;
|
||||
private readonly Guid _runspaceId;
|
||||
private readonly ConnectCommandInfo _connectCmdInfo = null;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2008,7 +2008,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
private readonly List<PipelineWriter> _inputWriters = new List<PipelineWriter>();
|
||||
private readonly object _jobSyncObject = new object();
|
||||
private bool _nojob = false;
|
||||
private Guid _instanceId = Guid.NewGuid();
|
||||
private readonly Guid _instanceId = Guid.NewGuid();
|
||||
private bool _propagateErrors = false;
|
||||
|
||||
private static readonly RobustConnectionProgress s_RCProgress = new RobustConnectionProgress();
|
||||
|
||||
@@ -1426,7 +1426,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
{
|
||||
#region Private Data
|
||||
|
||||
private Guid _vmGuid;
|
||||
private readonly Guid _vmGuid;
|
||||
private readonly string _configurationName;
|
||||
private readonly VMConnectionInfo _connectionInfo;
|
||||
private readonly NetworkCredential _networkCredential;
|
||||
@@ -1512,7 +1512,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
{
|
||||
#region Private Data
|
||||
|
||||
private Guid _targetGuid; // currently this is the utility vm guid in HyperV container scenario
|
||||
private readonly Guid _targetGuid; // currently this is the utility vm guid in HyperV container scenario
|
||||
private readonly ContainerConnectionInfo _connectionInfo;
|
||||
|
||||
#endregion
|
||||
@@ -2525,7 +2525,7 @@ namespace System.Management.Automation.Remoting.Server
|
||||
|
||||
private readonly OutOfProcessTextWriter _stdOutWriter;
|
||||
private readonly OutOfProcessTextWriter _stdErrWriter;
|
||||
private Guid _powershellInstanceId;
|
||||
private readonly Guid _powershellInstanceId;
|
||||
private bool _isDataAckSendPending;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -21,12 +21,12 @@ namespace System.Management.Automation.Remoting
|
||||
/// <summary>
|
||||
/// Client runspace pool id.
|
||||
/// </summary>
|
||||
private Guid _clientRunspacePoolId;
|
||||
private readonly Guid _clientRunspacePoolId;
|
||||
|
||||
/// <summary>
|
||||
/// Client power shell id.
|
||||
/// </summary>
|
||||
private Guid _clientPowerShellId;
|
||||
private readonly Guid _clientPowerShellId;
|
||||
|
||||
/// <summary>
|
||||
/// Server dispatch table.
|
||||
|
||||
@@ -30,12 +30,12 @@ namespace System.Management.Automation.Remoting
|
||||
/// <summary>
|
||||
/// Client runspace pool id.
|
||||
/// </summary>
|
||||
private Guid _clientRunspacePoolId;
|
||||
private readonly Guid _clientRunspacePoolId;
|
||||
|
||||
/// <summary>
|
||||
/// Client power shell id.
|
||||
/// </summary>
|
||||
private Guid _clientPowerShellId;
|
||||
private readonly Guid _clientPowerShellId;
|
||||
|
||||
/// <summary>
|
||||
/// Transport manager.
|
||||
|
||||
@@ -409,7 +409,7 @@ namespace System.Management.Automation
|
||||
|
||||
#region Private Members
|
||||
|
||||
private Guid _clientRunspacePoolId;
|
||||
private readonly Guid _clientRunspacePoolId;
|
||||
// transport manager using which this
|
||||
// runspace pool driver handles all client
|
||||
// communication
|
||||
@@ -436,8 +436,8 @@ namespace System.Management.Automation
|
||||
// powershell driver handles all client
|
||||
// communication
|
||||
private readonly AbstractServerTransportManager _transportManager;
|
||||
private Guid _clientRunspacePoolId;
|
||||
private Guid _clientPowerShellId;
|
||||
private readonly Guid _clientRunspacePoolId;
|
||||
private readonly Guid _clientPowerShellId;
|
||||
private readonly RemoteStreamOptions _streamSerializationOptions;
|
||||
private Runspace _rsUsedToInvokePowerShell;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace System.Management.Automation.Help
|
||||
}
|
||||
}
|
||||
|
||||
private Guid _moduleGuid;
|
||||
private readonly Guid _moduleGuid;
|
||||
|
||||
/// <summary>
|
||||
/// Module path.
|
||||
|
||||
@@ -1552,7 +1552,7 @@ namespace System.Management.Automation.Internal
|
||||
#region Private Fields
|
||||
|
||||
private readonly PSDataCollection<T> _objects;
|
||||
private Guid _psInstanceId;
|
||||
private readonly Guid _psInstanceId;
|
||||
private bool _isOpen;
|
||||
private PipelineWriter _writer;
|
||||
private PipelineReader<object> _objectReader;
|
||||
|
||||
Reference in New Issue
Block a user