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
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,8 @@ private TSession GetImpliedSession()
/// <param name="passThru"><c>true</c> if successful method invocations should emit downstream the <paramref name="objectInstance"/> being operated on.</param>
public override void ProcessRecord(TObjectInstance objectInstance, MethodInvocationInfo methodInvocationInfo, bool passThru)
{
if (objectInstance == null) throw new ArgumentNullException("objectInstance");
if (methodInvocationInfo == null) throw new ArgumentNullException("methodInvocationInfo");
if (objectInstance == null) throw new ArgumentNullException(nameof(objectInstance));
if (methodInvocationInfo == null) throw new ArgumentNullException(nameof(methodInvocationInfo));

foreach (TSession sessionForJob in this.GetSessionsToActAgainst(objectInstance))
{
Expand All @@ -607,7 +607,7 @@ public override void ProcessRecord(TObjectInstance objectInstance, MethodInvocat
/// <param name="methodInvocationInfo">Method invocation details.</param>
public override void ProcessRecord(MethodInvocationInfo methodInvocationInfo)
{
if (methodInvocationInfo == null) throw new ArgumentNullException("methodInvocationInfo");
if (methodInvocationInfo == null) throw new ArgumentNullException(nameof(methodInvocationInfo));

foreach (TSession sessionForJob in this.GetSessionsToActAgainst(methodInvocationInfo))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected CimJobException(
{
if (info == null)
{
throw new ArgumentNullException("info");
throw new ArgumentNullException(nameof(info));
}

_errorRecord = (ErrorRecord)info.GetValue("errorRecord", typeof(ErrorRecord));
Expand All @@ -71,7 +71,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
{
if (info == null)
{
throw new ArgumentNullException("info");
throw new ArgumentNullException(nameof(info));
}

base.GetObjectData(info, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ private unsafe void Copy(char* source, int offset, int charsToCopy)
{
if ((offset < 0) || (offset >= _string.Length))
{
throw new ArgumentOutOfRangeException("offset");
throw new ArgumentOutOfRangeException(nameof(offset));
}

if (offset + charsToCopy > _string.Length)
{
throw new ArgumentOutOfRangeException("charsToCopy");
throw new ArgumentOutOfRangeException(nameof(charsToCopy));
}

fixed (char* target = _string)
Expand Down Expand Up @@ -352,7 +352,7 @@ internal static object ConvertFromDotNetToCim(object dotNetObject)
/// <exception cref="PSInvalidCastException">The only kind of exception this method can throw.</exception>
internal static object ConvertFromCimToDotNet(object cimObject, Type expectedDotNetType)
{
if (expectedDotNetType == null) { throw new ArgumentNullException("expectedDotNetType"); }
if (expectedDotNetType == null) { throw new ArgumentNullException(nameof(expectedDotNetType)); }

if (cimObject == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,12 @@ public override void AddQueryOption(string optionName, object optionValue)
{
if (string.IsNullOrEmpty(optionName))
{
throw new ArgumentNullException("optionName");
throw new ArgumentNullException(nameof(optionName));
}

if (optionValue == null)
{
throw new ArgumentNullException("optionValue");
throw new ArgumentNullException(nameof(optionValue));
}

this.queryOptions[optionName] = optionValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ internal override StartableJob CreateQueryJob(CimSession session, QueryBuilder b
CimQuery query = baseQuery as CimQuery;
if (query == null)
{
throw new ArgumentNullException("baseQuery");
throw new ArgumentNullException(nameof(baseQuery));
}

TerminatingErrorTracker tracker = TerminatingErrorTracker.GetTracker(this.CmdletInvocationInfo, isStaticCmdlet: false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ internal static string WqlQueryAll(string from)
internal static T GetFirst<T>(CimSession session, string nameSpace, string wmiClassName) where T : class, new()
{
if (string.IsNullOrEmpty(wmiClassName))
throw new ArgumentException("String argument may not be null or empty", "wmiClassName");
throw new ArgumentException("String argument may not be null or empty", nameof(wmiClassName));

try
{
Expand Down Expand Up @@ -133,7 +133,7 @@ internal static string WqlQueryAll(string from)
internal static T[] GetAll<T>(CimSession session, string nameSpace, string wmiClassName) where T : class, new()
{
if (string.IsNullOrEmpty(wmiClassName))
throw new ArgumentException("String argument may not be null or empty", "wmiClassName");
throw new ArgumentException("String argument may not be null or empty", nameof(wmiClassName));

var rv = new List<T>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private RestartComputerTimeoutException(SerializationInfo info, StreamingContext
{
if (info == null)
{
throw new PSArgumentNullException("info");
throw new PSArgumentNullException(nameof(info));
}

ComputerName = info.GetString("ComputerName");
Expand All @@ -128,7 +128,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
{
if (info == null)
{
throw new PSArgumentNullException("info");
throw new PSArgumentNullException(nameof(info));
}

base.GetObjectData(info, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ internal ContentHolder(
{
if (pathInfo == null)
{
throw PSTraceSource.NewArgumentNullException("pathInfo");
throw PSTraceSource.NewArgumentNullException(nameof(pathInfo));
}

PathInfo = pathInfo;
Expand All @@ -370,7 +370,7 @@ internal void CloseContent(List<ContentHolder> contentHolders, bool disposing)
{
if (contentHolders == null)
{
throw PSTraceSource.NewArgumentNullException("contentHolders");
throw PSTraceSource.NewArgumentNullException(nameof(contentHolders));
}

foreach (ContentHolder holder in contentHolders)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3005,7 +3005,7 @@ public override void GetObjectData(
base.GetObjectData(info, context);

if (info == null)
throw new ArgumentNullException("info");
throw new ArgumentNullException(nameof(info));

info.AddValue("ProcessName", _processName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ private void IncludeExcludeAdd(
private bool Matches(ServiceController service, string[] matchList)
{
if (matchList == null)
throw PSTraceSource.NewArgumentNullException("matchList");
throw PSTraceSource.NewArgumentNullException(nameof(matchList));
string serviceID = (selectionMode == SelectionMode.DisplayName)
? service.DisplayName
: service.ServiceName;
Expand Down Expand Up @@ -2566,7 +2566,7 @@ protected ServiceCommandException(SerializationInfo info, StreamingContext conte
{
if (info == null)
{
throw new ArgumentNullException("info");
throw new ArgumentNullException(nameof(info));
}

_serviceName = info.GetString("ServiceName");
Expand All @@ -2581,7 +2581,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
{
if (info == null)
{
throw new ArgumentNullException("info");
throw new ArgumentNullException(nameof(info));
}

base.GetObjectData(info, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal override void BeforeOpenStreams(string[] paths)
{
if (paths == null || paths.Length == 0)
{
throw PSTraceSource.NewArgumentNullException("paths");
throw PSTraceSource.NewArgumentNullException(nameof(paths));
}

CmdletProviderContext context = new CmdletProviderContext(GetCurrentContext());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ private OutputKind OutputAssemblyTypeToOutputKind(OutputAssemblyType outputType)
case OutputAssemblyType.WindowsApplication:
return OutputKind.WindowsApplication;
default:
throw new ArgumentOutOfRangeException("outputType");
throw new ArgumentOutOfRangeException(nameof(outputType));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ internal CustomSerialization(XmlWriter writer, bool notypeinformation, int depth
{
if (writer == null)
{
throw PSTraceSource.NewArgumentException("writer");
throw PSTraceSource.NewArgumentException(nameof(writer));
}

if (depth < 1)
{
throw PSTraceSource.NewArgumentException("writer", Serialization.DepthOfOneRequired);
throw PSTraceSource.NewArgumentException(nameof(writer), Serialization.DepthOfOneRequired);
}

_depth = depth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public int RunspaceId
/// <param name="runspaceId">Runspace local Id.</param>
public PSRunspaceDebug(bool enabled, bool breakAll, string runspaceName, int runspaceId)
{
if (string.IsNullOrEmpty(runspaceName)) { throw new PSArgumentNullException("runspaceName"); }
if (string.IsNullOrEmpty(runspaceName)) { throw new PSArgumentNullException(nameof(runspaceName)); }

this.Enabled = enabled;
this.BreakAll = breakAll;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ internal void AddColumns(string[] propertyNames, string[] displayNames, Type[] t
{
if (propertyNames == null)
{
throw new ArgumentNullException("propertyNames");
throw new ArgumentNullException(nameof(propertyNames));
}

if (displayNames == null)
{
throw new ArgumentNullException("displayNames");
throw new ArgumentNullException(nameof(displayNames));
}

if (types == null)
{
throw new ArgumentNullException("types");
throw new ArgumentNullException(nameof(types));
}

try
Expand Down Expand Up @@ -178,7 +178,7 @@ internal void AddItem(PSObject livePSObject)
{
if (livePSObject == null)
{
throw new ArgumentNullException("livePSObject");
throw new ArgumentNullException(nameof(livePSObject));
}

if (_headerInfo == null)
Expand All @@ -204,7 +204,7 @@ internal void AddHeteroViewItem(PSObject livePSObject)
{
if (livePSObject == null)
{
throw new ArgumentNullException("livePSObject");
throw new ArgumentNullException(nameof(livePSObject));
}

if (_headerInfo == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ internal int Next(int maxValue)
{
if (maxValue < 0)
{
throw new ArgumentOutOfRangeException("maxValue", GetRandomCommandStrings.MaxMustBeGreaterThanZeroApi);
throw new ArgumentOutOfRangeException(nameof(maxValue), GetRandomCommandStrings.MaxMustBeGreaterThanZeroApi);
}

return Next(0, maxValue);
Expand All @@ -660,7 +660,7 @@ public int Next(int minValue, int maxValue)
{
if (minValue > maxValue)
{
throw new ArgumentOutOfRangeException("minValue", GetRandomCommandStrings.MinGreaterThanOrEqualMaxApi);
throw new ArgumentOutOfRangeException(nameof(minValue), GetRandomCommandStrings.MinGreaterThanOrEqualMaxApi);
}

int randomNumber = 0;
Expand Down
Loading