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 @@ -151,7 +151,7 @@ public void RegisterCimIndication(
DebugHelper.WriteLogEx("queryDialect = '{0}'; queryExpression = '{1}'", 0, queryDialect, queryExpression);
if (cimSession == null)
{
throw new ArgumentNullException(string.Format(CultureInfo.CurrentUICulture, CimCmdletStrings.NullArgument, @"cimSession"));
throw new ArgumentNullException(string.Format(CultureInfo.CurrentUICulture, CimCmdletStrings.NullArgument, nameof(cimSession)));
}

this.TargetComputerName = cimSession.ComputerName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,7 @@ protected TSession[] Session

set
{
if (value == null)
{
throw new ArgumentNullException("value");
}

_session = value;
_session = value ?? throw new ArgumentNullException(nameof(value));
_sessionWasSpecified = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ private void AddMultipartContent(object fieldName, object fieldValue, MultipartF
{
if (formData == null)
{
throw new ArgumentNullException("formDate");
throw new ArgumentNullException(nameof(formData));
}

// It is possible that the dictionary keys or values are PSObject wrapped depending on how the dictionary is defined and assigned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ public bool WriteEvent(in EventDescriptor eventDescriptor, string data)

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

if (IsEnabled(eventDescriptor.Level, eventDescriptor.Keywords))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public string Delimiter
set
{
if (value == null)
throw new ArgumentNullException("Delimiter");
throw new ArgumentNullException(nameof(Delimiter));

if (value.Length == 0)
throw new ArgumentException(DotNetEventingStrings.Argument_NeedNonemptyDelimiter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6680,7 +6680,7 @@ internal object Deserialize(XmlReader reader)
{
if (reader == null)
{
throw new ArgumentNullException("reader");
throw new ArgumentNullException(nameof(reader));
}

XmlSerializationReader1 cdxmlSerializationReader = new XmlSerializationReader1(reader);
Expand Down
9 changes: 2 additions & 7 deletions src/System.Management.Automation/engine/GetCommandCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,7 @@ public string[] ParameterName

set
{
if (value == null)
{
throw new ArgumentNullException("value");
}

_parameterNames = value;
_parameterNames = value ?? throw new ArgumentNullException(nameof(value));
_parameterNameWildcards = SessionStateUtilities.CreateWildcardsFromStrings(
_parameterNames,
WildcardOptions.CultureInvariant | WildcardOptions.IgnoreCase);
Expand All @@ -319,7 +314,7 @@ public PSTypeName[] ParameterType
{
if (value == null)
{
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
}

// if '...CimInstance#Win32_Process' is specified, then exclude '...CimInstance'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,7 @@ public BackgroundDispatcher(EventProvider transferProvider, EventDescriptor tran
// internal for unit testing only. Otherwise, would be private.
internal BackgroundDispatcher(IMethodInvoker etwActivityMethodInvoker)
{
if (etwActivityMethodInvoker == null)
{
throw new ArgumentNullException("etwActivityMethodInvoker");
}

_etwActivityMethodInvoker = etwActivityMethodInvoker;
_etwActivityMethodInvoker = etwActivityMethodInvoker ?? throw new ArgumentNullException(nameof(etwActivityMethodInvoker));
_invokerWaitCallback = DoInvoker;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ public override bool UpdateCounterByValue(string counterName, long stepAmount, b
// retrieve counter id associated with the counter name
if (counterName == null)
{
ArgumentNullException argNullException = new ArgumentNullException("counterName");
ArgumentNullException argNullException = new ArgumentNullException(nameof(counterName));
_tracer.TraceException(argNullException);
return false;
}
Expand Down Expand Up @@ -484,7 +484,7 @@ public override bool SetCounterValue(string counterName, long counterValue, bool
// retrieve counter id associated with the counter name
if (counterName == null)
{
ArgumentNullException argNullException = new ArgumentNullException("counterName");
ArgumentNullException argNullException = new ArgumentNullException(nameof(counterName));
_tracer.TraceException(argNullException);
return false;
}
Expand Down Expand Up @@ -568,7 +568,7 @@ public override bool GetCounterValue(string counterName, bool isNumerator, out l
// retrieve counter id associated with the counter name
if (counterName == null)
{
ArgumentNullException argNullException = new ArgumentNullException("counterName");
ArgumentNullException argNullException = new ArgumentNullException(nameof(counterName));
_tracer.TraceException(argNullException);
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected CounterSetRegistrarBase(
if ((counterInfoArray == null)
|| (counterInfoArray.Length == 0))
{
throw new ArgumentNullException("counterInfoArray");
throw new ArgumentNullException(nameof(counterInfoArray));
}

CounterInfoArray = new CounterInfo[counterInfoArray.Length];
Expand All @@ -136,7 +136,7 @@ protected CounterSetRegistrarBase(
{
if (srcCounterSetRegistrarBase == null)
{
throw new ArgumentNullException("srcCounterSetRegistrarBase");
throw new ArgumentNullException(nameof(srcCounterSetRegistrarBase));
}

ProviderId = srcCounterSetRegistrarBase.ProviderId;
Expand Down Expand Up @@ -243,7 +243,7 @@ public PSCounterSetRegistrar(
{
if (srcPSCounterSetRegistrar == null)
{
throw new ArgumentNullException("srcPSCounterSetRegistrar");
throw new ArgumentNullException(nameof(srcPSCounterSetRegistrar));
}
}

Expand Down