diff --git a/src/System.Management.Automation/namespaces/LocationGlobber.cs b/src/System.Management.Automation/namespaces/LocationGlobber.cs index ed8290ef1e..217d3787e1 100644 --- a/src/System.Management.Automation/namespaces/LocationGlobber.cs +++ b/src/System.Management.Automation/namespaces/LocationGlobber.cs @@ -58,7 +58,7 @@ namespace System.Management.Automation { if (sessionState == null) { - throw PSTraceSource.NewArgumentNullException("sessionState"); + throw PSTraceSource.NewArgumentNullException(nameof(sessionState)); } _sessionState = sessionState; @@ -174,12 +174,12 @@ namespace System.Management.Automation providerInstance = null; if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } if (context == null) { - throw PSTraceSource.NewArgumentNullException("context"); + throw PSTraceSource.NewArgumentNullException(nameof(context)); } Collection result; @@ -663,7 +663,7 @@ namespace System.Management.Automation providerInstance = null; if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } CmdletProviderContext context = @@ -738,12 +738,12 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } if (context == null) { - throw PSTraceSource.NewArgumentNullException("context"); + throw PSTraceSource.NewArgumentNullException(nameof(context)); } using (s_pathResolutionTracer.TraceScope("Resolving MSH path \"{0}\" to PROVIDER-INTERNAL path", path)) @@ -849,7 +849,7 @@ namespace System.Management.Automation if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } CmdletProviderContext context = @@ -935,17 +935,17 @@ namespace System.Management.Automation if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } if (providerId == null) { - throw PSTraceSource.NewArgumentNullException("providerId"); + throw PSTraceSource.NewArgumentNullException(nameof(providerId)); } if (context == null) { - throw PSTraceSource.NewArgumentNullException("context"); + throw PSTraceSource.NewArgumentNullException(nameof(context)); } using (s_pathResolutionTracer.TraceScope("Resolving PROVIDER-INTERNAL path \"{0}\" to PROVIDER-INTERNAL path", path)) @@ -1057,7 +1057,7 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } CmdletProviderContext context = @@ -1129,7 +1129,7 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } PSDriveInfo drive = null; @@ -1217,12 +1217,12 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } if (context == null) { - throw PSTraceSource.NewArgumentNullException("context"); + throw PSTraceSource.NewArgumentNullException(nameof(context)); } string result = null; @@ -1374,7 +1374,7 @@ namespace System.Management.Automation if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } providerId = null; @@ -1472,7 +1472,7 @@ namespace System.Management.Automation if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } bool result = false; @@ -1561,7 +1561,7 @@ namespace System.Management.Automation if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } bool result = false; @@ -1672,7 +1672,7 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } string result = WildcardPattern.Unescape(path); @@ -1714,7 +1714,7 @@ namespace System.Management.Automation { if (driveName == null) { - throw PSTraceSource.NewArgumentNullException("driveName"); + throw PSTraceSource.NewArgumentNullException(nameof(driveName)); } bool result = false; @@ -1817,7 +1817,7 @@ namespace System.Management.Automation if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } workingDriveForPath = null; @@ -2048,12 +2048,12 @@ namespace System.Management.Automation if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } if (drive == null) { - throw PSTraceSource.NewArgumentNullException("drive"); + throw PSTraceSource.NewArgumentNullException(nameof(drive)); } // This string will be filled in with the @@ -2321,12 +2321,12 @@ namespace System.Management.Automation { if (drive == null) { - throw PSTraceSource.NewArgumentNullException("drive"); + throw PSTraceSource.NewArgumentNullException(nameof(drive)); } if (workingPath == null) { - throw PSTraceSource.NewArgumentNullException("workingPath"); + throw PSTraceSource.NewArgumentNullException(nameof(workingPath)); } // Trace the inputs @@ -2380,7 +2380,7 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } int providerIdSeparatorIndex = path.IndexOf(StringLiterals.ProviderPathSeparator, StringComparison.Ordinal); @@ -2459,17 +2459,17 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } if (containerProvider == null) { - throw PSTraceSource.NewArgumentNullException("containerProvider"); + throw PSTraceSource.NewArgumentNullException(nameof(containerProvider)); } if (context == null) { - throw PSTraceSource.NewArgumentNullException("context"); + throw PSTraceSource.NewArgumentNullException(nameof(context)); } Collection expandedPaths = @@ -2499,7 +2499,7 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } return WildcardPattern.ContainsWildcardCharacters(path); @@ -2636,17 +2636,17 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } if (provider == null) { - throw PSTraceSource.NewArgumentNullException("provider"); + throw PSTraceSource.NewArgumentNullException(nameof(provider)); } if (drive == null) { - throw PSTraceSource.NewArgumentNullException("drive"); + throw PSTraceSource.NewArgumentNullException(nameof(drive)); } s_tracer.WriteLine("path = {0}", path); @@ -3061,12 +3061,12 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } if (drive == null) { - throw PSTraceSource.NewArgumentNullException("drive"); + throw PSTraceSource.NewArgumentNullException(nameof(drive)); } string result = path; @@ -3205,12 +3205,12 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } if (provider == null) { - throw PSTraceSource.NewArgumentNullException("provider"); + throw PSTraceSource.NewArgumentNullException(nameof(provider)); } string result = path; @@ -3345,12 +3345,12 @@ namespace System.Management.Automation { if (currentDirs == null) { - throw PSTraceSource.NewArgumentNullException("currentDirs"); + throw PSTraceSource.NewArgumentNullException(nameof(currentDirs)); } if (provider == null) { - throw PSTraceSource.NewArgumentNullException("provider"); + throw PSTraceSource.NewArgumentNullException(nameof(provider)); } NavigationCmdletProvider navigationProvider = provider as NavigationCmdletProvider; @@ -3579,12 +3579,12 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } if (provider == null) { - throw PSTraceSource.NewArgumentNullException("provider"); + throw PSTraceSource.NewArgumentNullException(nameof(provider)); } // See if the provider wants to convert the path and filter @@ -3951,12 +3951,12 @@ namespace System.Management.Automation { if (currentDirs == null) { - throw PSTraceSource.NewArgumentNullException("currentDirs"); + throw PSTraceSource.NewArgumentNullException(nameof(currentDirs)); } if (provider == null) { - throw PSTraceSource.NewArgumentNullException("provider"); + throw PSTraceSource.NewArgumentNullException(nameof(provider)); } NavigationCmdletProvider navigationProvider = provider as NavigationCmdletProvider; @@ -4432,7 +4432,7 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } const char mshEscapeChar = '`'; @@ -4522,7 +4522,7 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } bool result = false; @@ -4571,7 +4571,7 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } return path.StartsWith(StringLiterals.DefaultRemotePathPrefix, StringComparison.Ordinal) || @@ -4611,7 +4611,7 @@ namespace System.Management.Automation { if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } string result = path; diff --git a/src/System.Management.Automation/namespaces/PathInfo.cs b/src/System.Management.Automation/namespaces/PathInfo.cs index fb1834227a..9440eb56e5 100644 --- a/src/System.Management.Automation/namespaces/PathInfo.cs +++ b/src/System.Management.Automation/namespaces/PathInfo.cs @@ -145,17 +145,17 @@ namespace System.Management.Automation { if (provider == null) { - throw PSTraceSource.NewArgumentNullException("provider"); + throw PSTraceSource.NewArgumentNullException(nameof(provider)); } if (path == null) { - throw PSTraceSource.NewArgumentNullException("path"); + throw PSTraceSource.NewArgumentNullException(nameof(path)); } if (sessionState == null) { - throw PSTraceSource.NewArgumentNullException("sessionState"); + throw PSTraceSource.NewArgumentNullException(nameof(sessionState)); } _drive = drive;