mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
spelling: debug, assert...
This commit is contained in:
@@ -388,7 +388,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
||||
/// <param name="cimInstance"></param>
|
||||
public CimSessionProxy(string computerName, CimInstance cimInstance)
|
||||
{
|
||||
DebugHelper.WriteLogEx("ComptuerName {0}; cimInstance.CimSessionInstanceID = {1}; cimInstance.CimSessionComputerName = {2}.",
|
||||
DebugHelper.WriteLogEx("ComputerName {0}; cimInstance.CimSessionInstanceID = {1}; cimInstance.CimSessionComputerName = {2}.",
|
||||
0,
|
||||
computerName,
|
||||
cimInstance.GetCimSessionInstanceId(),
|
||||
@@ -716,7 +716,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
||||
|
||||
lock (this.stateLock)
|
||||
{
|
||||
Debug.Assert(this.operation == operation, "Caller should verify that the operation to reomove is the operation in progress");
|
||||
Debug.Assert(this.operation == operation, "Caller should verify that the operation to remove is the operation in progress");
|
||||
|
||||
this.DisposeCancelOperation();
|
||||
|
||||
@@ -2139,7 +2139,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
||||
|
||||
if (!match)
|
||||
{
|
||||
DebugHelper.WriteLog("Qualifer name does not match: {0}", 1, context.QualifierName);
|
||||
DebugHelper.WriteLog("Qualifier name does not match: {0}", 1, context.QualifierName);
|
||||
return match;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace Microsoft.PackageManagement.NuGetProvider
|
||||
throw new ArgumentNullException("request");
|
||||
}
|
||||
try {
|
||||
request.Debug(string.Format(CultureInfo.InvariantCulture, "AddPackageSource - ProvidenName = '{0}', name='{1}', location='{2}', trusted='{3}'", PackageProviderName, name, location, trusted));
|
||||
request.Debug(string.Format(CultureInfo.InvariantCulture, "AddPackageSource - ProviderName = '{0}', name='{1}', location='{2}', trusted='{3}'", PackageProviderName, name, location, trusted));
|
||||
|
||||
// Error out if a user does not provide package source Name
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
|
||||
+5
-5
@@ -1389,9 +1389,9 @@ namespace Microsoft.PowerShell.Commands
|
||||
Dictionary<string, string> alias2resolvedCommandName,
|
||||
PSObject remoteCommandInfo)
|
||||
{
|
||||
Dbg.Assert(name2commandMetadata != null, "name2commandMetadata paremeter != null");
|
||||
Dbg.Assert(alias2resolvedCommandName != null, "alias2resolvedCommandName paremeter != null");
|
||||
Dbg.Assert(remoteCommandInfo != null, "remoteCommandInfo paremeter != null");
|
||||
Dbg.Assert(name2commandMetadata != null, "name2commandMetadata parameter != null");
|
||||
Dbg.Assert(alias2resolvedCommandName != null, "alias2resolvedCommandName parameter != null");
|
||||
Dbg.Assert(remoteCommandInfo != null, "remoteCommandInfo parameter != null");
|
||||
|
||||
string resolvedCommandName;
|
||||
CommandMetadata commandMetadata = RehydrateCommandMetadata(remoteCommandInfo, out resolvedCommandName);
|
||||
@@ -1455,8 +1455,8 @@ namespace Microsoft.PowerShell.Commands
|
||||
|
||||
private void AddRemoteTypeDefinition(IList<ExtendedTypeDefinition> listOfTypeDefinitions, PSObject remoteTypeDefinition)
|
||||
{
|
||||
Dbg.Assert(listOfTypeDefinitions != null, "listOfTypeDefinitions paremeter != null");
|
||||
Dbg.Assert(remoteTypeDefinition != null, "remoteTypeDefinition paremeter != null");
|
||||
Dbg.Assert(listOfTypeDefinitions != null, "listOfTypeDefinitions parameter != null");
|
||||
Dbg.Assert(remoteTypeDefinition != null, "remoteTypeDefinition parameter != null");
|
||||
|
||||
ExtendedTypeDefinition typeDefinition = ConvertTo<ExtendedTypeDefinition>("Get-FormatData", remoteTypeDefinition);
|
||||
if (!IsSafeTypeDefinition(typeDefinition))
|
||||
|
||||
+1
-1
@@ -371,7 +371,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
CommandInfo commandInfo;
|
||||
this.GetCommandInfoAndModules(out commandInfo, out _importedModules);
|
||||
Diagnostics.Assert(commandInfo != null, "GetCommandInfoAndModules would throw a termninating error/exception");
|
||||
Diagnostics.Assert(commandInfo != null, "GetCommandInfoAndModules would throw a terminating error/exception");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -376,7 +376,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
Dbg.Assert(false, "Either RunspaceConfiguration or InitiaSessionState must be non-null for Update-Typedata to work");
|
||||
Dbg.Assert(false, "Either RunspaceConfiguration or InitialSessionState must be non-null for Update-Typedata to work");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -494,7 +494,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
Dbg.Assert(false, "Either RunspaceConfiguration or InitiaSessionState must be non-null for Update-Typedata to work");
|
||||
Dbg.Assert(false, "Either RunspaceConfiguration or InitialSessionState must be non-null for Update-Typedata to work");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -887,7 +887,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
Dbg.Assert(false, "Either RunspaceConfiguration or InitiaSessionState must be non-null for Update-Typedata to work");
|
||||
Dbg.Assert(false, "Either RunspaceConfiguration or InitialSessionState must be non-null for Update-Typedata to work");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1069,7 +1069,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
Dbg.Assert(false, "Either RunspaceConfiguration or InitiaSessionState must be non-null for Update-FormatData to work");
|
||||
Dbg.Assert(false, "Either RunspaceConfiguration or InitialSessionState must be non-null for Update-FormatData to work");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1289,7 +1289,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
Dbg.Assert(false, "Either RunspaceConfiguration or InitiaSessionState must be non-null for Remove-Typedata to work");
|
||||
Dbg.Assert(false, "Either RunspaceConfiguration or InitialSessionState must be non-null for Remove-Typedata to work");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -481,7 +481,7 @@ namespace Microsoft.PowerShell.Workflow
|
||||
{
|
||||
//ignoring the error message and just logging them into ETW
|
||||
_tracer.WriteMessage(String.Format(CultureInfo.InvariantCulture,
|
||||
"WorkflowJobSourceAdapter: Ingnoring the exception. Exception details: {0}",
|
||||
"WorkflowJobSourceAdapter: Ignoring the exception. Exception details: {0}",
|
||||
exception));
|
||||
innerException = exception;
|
||||
_structuredTracer.JobRemoveError(job.InstanceId,
|
||||
@@ -499,7 +499,7 @@ namespace Microsoft.PowerShell.Workflow
|
||||
{
|
||||
//ignoring the error message and just logging them into ETW
|
||||
_tracer.WriteMessage(String.Format(CultureInfo.InvariantCulture,
|
||||
"WorkflowJobSourceAdapter: Ingnoring the exception. Exception details: {0}",
|
||||
"WorkflowJobSourceAdapter: Ignoring the exception. Exception details: {0}",
|
||||
exception));
|
||||
innerException = exception;
|
||||
}
|
||||
@@ -547,7 +547,7 @@ namespace Microsoft.PowerShell.Workflow
|
||||
{
|
||||
//ignoring the error message and just logging them into ETW
|
||||
_tracer.WriteMessage(String.Format(CultureInfo.InvariantCulture,
|
||||
"WorkflowJobSourceAdapter: Ingnoring the exception. Exception details: {0}",
|
||||
"WorkflowJobSourceAdapter: Ignoring the exception. Exception details: {0}",
|
||||
exception));
|
||||
|
||||
_structuredTracer.JobRemoveError(job.InstanceId,
|
||||
@@ -566,7 +566,7 @@ namespace Microsoft.PowerShell.Workflow
|
||||
{
|
||||
//ignoring the error message and just logging them into ETW
|
||||
_tracer.WriteMessage(String.Format(CultureInfo.InvariantCulture,
|
||||
"WorkflowJobSourceAdapter: Ingnoring the exception. Exception details: {0}",
|
||||
"WorkflowJobSourceAdapter: Ignoring the exception. Exception details: {0}",
|
||||
exception));
|
||||
}
|
||||
job.Dispose();
|
||||
@@ -904,7 +904,7 @@ namespace Microsoft.PowerShell.Workflow
|
||||
"Shutting down WSMan server: Exception details: {0}",
|
||||
exception));
|
||||
|
||||
Dbg.Assert(false, "Exception has happned during the shutdown API. [Message] " + exception.Message + "[StackTrace] " + exception.StackTrace);
|
||||
Dbg.Assert(false, "Exception has happened during the shutdown API. [Message] " + exception.Message + "[StackTrace] " + exception.StackTrace);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1633,7 +1633,7 @@ function __cmdletization_BindCommonParameters
|
||||
methodName = "FilterByMaxPropertyValue";
|
||||
break;
|
||||
default:
|
||||
Dbg.Assert(false, "Unrecognize query xml element");
|
||||
Dbg.Assert(false, "Unrecognized query xml element");
|
||||
methodName = "NotAValidMethod";
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -362,7 +362,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
||||
}
|
||||
else
|
||||
{
|
||||
Diagnostics.Assert(false, "unknonw shape: this should never happen unless a new shape is added");
|
||||
Diagnostics.Assert(false, "unknown shape: this should never happen unless a new shape is added");
|
||||
return null;
|
||||
}
|
||||
return GetView(expressionFactory, db, t, typeNames, viewName);
|
||||
|
||||
@@ -5722,7 +5722,7 @@ if($paths) {
|
||||
Diagnostics.Assert((object)pair.Value.HelpFileName == (object)other.HelpFileName, "Pre-generated Provider help file incorrect");
|
||||
Diagnostics.Assert(pair.Value.ImplementingType == other.ImplementingType, "Pre-generated Provider implementing type incorrect");
|
||||
Diagnostics.Assert(string.Equals(pair.Value.Name, other.Name, StringComparison.Ordinal), "Pre-generated Provider name incorrect");
|
||||
Diagnostics.Assert(pair.Value.PSSnapIn == other.PSSnapIn, "Pre-generated Provider snappin type incorrect");
|
||||
Diagnostics.Assert(pair.Value.PSSnapIn == other.PSSnapIn, "Pre-generated Provider snapin type incorrect");
|
||||
Diagnostics.Assert(pair.Value.Module == other.Module, "Pre-generated Provider module incorrect");
|
||||
Diagnostics.Assert(pair.Value.Visibility == other.Visibility, "Pre-generated Provider visibility incorrect");
|
||||
}
|
||||
@@ -5741,7 +5741,7 @@ if($paths) {
|
||||
Diagnostics.Assert((object)pair.Value.HelpFileName == (object)other.HelpFileName, "Pre-generated Provider help file incorrect");
|
||||
Diagnostics.Assert(pair.Value.ImplementingType == other.ImplementingType, "Pre-generated Provider implementing type incorrect");
|
||||
Diagnostics.Assert(string.Equals(pair.Value.Name, other.Name, StringComparison.Ordinal), "Pre-generated Provider name incorrect");
|
||||
Diagnostics.Assert(pair.Value.PSSnapIn == other.PSSnapIn, "Pre-generated Provider snappin type incorrect");
|
||||
Diagnostics.Assert(pair.Value.PSSnapIn == other.PSSnapIn, "Pre-generated Provider snapin type incorrect");
|
||||
Diagnostics.Assert(pair.Value.Module == other.Module, "Pre-generated Provider module incorrect");
|
||||
Diagnostics.Assert(pair.Value.Visibility == other.Visibility, "Pre-generated Provider visibility incorrect");
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
// get the matched member(s)
|
||||
ReadOnlyPSMemberInfoCollection<PSMemberInfo> members =
|
||||
_inputObject.Members.Match(_propertyOrMethodName, PSMemberTypes.All);
|
||||
Dbg.Assert(members != null, "The retrun value of Members.Match shoudl never be null");
|
||||
Dbg.Assert(members != null, "The return value of Members.Match should never be null");
|
||||
|
||||
if (members.Count > 1)
|
||||
{
|
||||
|
||||
@@ -4532,7 +4532,7 @@ namespace System.Management.Automation
|
||||
delegateOwner = PSObject.AsPSObject(delegateOwner);
|
||||
foreach (CollectionEntry<T> collection in Collections)
|
||||
{
|
||||
Diagnostics.Assert(delegateOwner != null, "all integrating collections with non emtpty collections have an associated PSObject");
|
||||
Diagnostics.Assert(delegateOwner != null, "all integrating collections with non empty collections have an associated PSObject");
|
||||
T memberAsT = collection.GetMember((PSObject)delegateOwner, name);
|
||||
if (memberAsT != null)
|
||||
{
|
||||
|
||||
@@ -1405,7 +1405,7 @@ namespace System.Management.Automation
|
||||
/// </param>
|
||||
internal void Start(Process process, NativeCommandIOFormat inputFormat)
|
||||
{
|
||||
Dbg.Assert(process != null, "caller should validate the paramter");
|
||||
Dbg.Assert(process != null, "caller should validate the parameter");
|
||||
|
||||
//Get the encoding for writing to native command. Note we get the Encoding
|
||||
//from the current scope so a script or function can use a different encoding
|
||||
|
||||
@@ -358,7 +358,7 @@ namespace System.Management.Automation.Runspaces
|
||||
void
|
||||
SetMergeSettingsOnCommandProcessor(CommandProcessorBase commandProcessor)
|
||||
{
|
||||
Dbg.Assert(commandProcessor != null, "caller should valiadate the parameter");
|
||||
Dbg.Assert(commandProcessor != null, "caller should validate the parameter");
|
||||
|
||||
MshCommandRuntime mcr = commandProcessor.Command.commandRuntime as MshCommandRuntime;
|
||||
|
||||
@@ -477,8 +477,8 @@ namespace System.Management.Automation.Runspaces
|
||||
break;
|
||||
default:
|
||||
// This should never happen...
|
||||
Diagnostics.Assert(false, "Invalid langage mode was set when building a ScriptCommandProcessor");
|
||||
throw new InvalidOperationException("Invalid langage mode was set when building a ScriptCommandProcessor");
|
||||
Diagnostics.Assert(false, "Invalid language mode was set when building a ScriptCommandProcessor");
|
||||
throw new InvalidOperationException("Invalid language mode was set when building a ScriptCommandProcessor");
|
||||
}
|
||||
|
||||
if (scriptBlock.UsesCmdletBinding)
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace System.Management.Automation.Language
|
||||
{
|
||||
static CharExtensions()
|
||||
{
|
||||
Diagnostics.Assert(s_traits.Length == 128, "Extention methods rely on this table size.");
|
||||
Diagnostics.Assert(s_traits.Length == 128, "Extension methods rely on this table size.");
|
||||
}
|
||||
|
||||
private static readonly CharTraits[] s_traits = new CharTraits[]
|
||||
|
||||
@@ -10698,7 +10698,7 @@ namespace System.Management.Automation.Language
|
||||
return ExtractUsingVariableImpl(memberExpr.Expression);
|
||||
}
|
||||
|
||||
Diagnostics.Assert(false, "We should alwasy be able to get a VariableExpressionAst from a UsingExpressionAst");
|
||||
Diagnostics.Assert(false, "We should always be able to get a VariableExpressionAst from a UsingExpressionAst");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
|
||||
default:
|
||||
{
|
||||
Dbg.Assert(false, "Missing paramenter set in switch statement");
|
||||
Dbg.Assert(false, "Missing parameter set in switch statement");
|
||||
remoteRunspaces = new List<RemoteRunspace>(); // added to avoid prefast warning
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1098,7 +1098,7 @@ namespace System.Management.Automation.Remoting
|
||||
internal PSObject DeserializeToPSObject(Stream serializedDataStream)
|
||||
{
|
||||
Dbg.Assert(null != serializedDataStream, "Cannot Deserialize null data");
|
||||
Dbg.Assert(serializedDataStream.Length != 0, "Cannot Deserialze empty data");
|
||||
Dbg.Assert(serializedDataStream.Length != 0, "Cannot Deserialize empty data");
|
||||
|
||||
object result = null;
|
||||
using (XmlReader xmlReader = XmlReader.Create(serializedDataStream, InternalDeserializer.XmlReaderSettingsForCliXml))
|
||||
|
||||
@@ -692,7 +692,7 @@ namespace System.Management.Automation.Remoting
|
||||
runspacepoolInitData.Serialize(stream, fragmentor);
|
||||
stream.Exit();
|
||||
byte[] outbuffer = stream.Read();
|
||||
Dbg.Assert(outbuffer != null, "connet response data should be serialized");
|
||||
Dbg.Assert(outbuffer != null, "connect response data should be serialized");
|
||||
stream.Dispose();
|
||||
//we are done
|
||||
connectResponseData = outbuffer;
|
||||
|
||||
+2
-2
@@ -457,7 +457,7 @@ namespace System.Management.Automation.Remoting
|
||||
throw PSTraceSource.NewArgumentNullException("fsmEventArg");
|
||||
}
|
||||
|
||||
Dbg.Assert(_state == RemoteSessionState.NegotiationSent, "State must be NeogtiationReceived");
|
||||
Dbg.Assert(_state == RemoteSessionState.NegotiationSent, "State must be NegotiationReceived");
|
||||
Dbg.Assert(fsmEventArg.StateEvent == RemoteSessionEvent.NegotiationCompleted, "StateEvent must be NegotiationCompleted");
|
||||
|
||||
if (fsmEventArg.StateEvent != RemoteSessionEvent.NegotiationCompleted)
|
||||
@@ -921,7 +921,7 @@ namespace System.Management.Automation.Remoting
|
||||
//***TODO*** Deal with this on the client side. Key exchange packets should have additional information
|
||||
//that identify the context of negotiation. Just like callId in SetMax and SetMinRunspaces messages
|
||||
Dbg.Assert(_state >= RemoteSessionState.Established,
|
||||
"Key Receving can only be raised after reaching the Established state");
|
||||
"Key Receiving can only be raised after reaching the Established state");
|
||||
|
||||
switch (eventArgs.StateEvent)
|
||||
{
|
||||
|
||||
@@ -714,7 +714,7 @@ namespace System.Management.Automation
|
||||
else
|
||||
{
|
||||
// If this assertion fires, the command name is determined incorrectly.
|
||||
Diagnostics.Assert(commandNameAst is CommandParameterAst, "Unxpected element not handled correctly.");
|
||||
Diagnostics.Assert(commandNameAst is CommandParameterAst, "Unexpected element not handled correctly.");
|
||||
commandName = commandNameAst.Extent.Text;
|
||||
}
|
||||
|
||||
@@ -739,7 +739,7 @@ namespace System.Management.Automation
|
||||
|
||||
// Process the contents of a splatted variable into the arguments for this
|
||||
// command. If the variable contains a hashtable, distribute the key/value pairs
|
||||
// If it's an enumberable, then distribute the values as $args and finally
|
||||
// If it's an enumerable, then distribute the values as $args and finally
|
||||
// if it's a scalar, then the effect is equivalent to $var
|
||||
object splattedValue = _context.GetVariableValue(variableAst.VariablePath);
|
||||
foreach (var splattedParameter in PipelineOps.Splat(splattedValue, variableAst.Extent))
|
||||
|
||||
@@ -1032,7 +1032,7 @@ namespace System.Management.Automation.Internal
|
||||
} // if (rsa != null...
|
||||
else
|
||||
{
|
||||
Dbg.Assert(false, "Session key not availble to encrypt secure string");
|
||||
Dbg.Assert(false, "Session key not available to encrypt secure string");
|
||||
}
|
||||
|
||||
return encryptedDataAsString;
|
||||
@@ -1392,7 +1392,7 @@ namespace System.Management.Automation.Internal
|
||||
/// <returns></returns>
|
||||
internal bool ImportEncryptedSessionKey(string encryptedSessionKey)
|
||||
{
|
||||
Dbg.Assert(!String.IsNullOrEmpty(encryptedSessionKey), "encrypted sessoin key passed in cannot be null");
|
||||
Dbg.Assert(!String.IsNullOrEmpty(encryptedSessionKey), "encrypted session key passed in cannot be null");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user