diff --git a/src/Compilers/Core/Portable/Text/LinePositionSpan.cs b/src/Compilers/Core/Portable/Text/LinePositionSpan.cs index 8a192b3bbdfd13918e0ad23001e15524e9e1f71c..81143d65c2307880af740553d98b877cfbe5e85c 100644 --- a/src/Compilers/Core/Portable/Text/LinePositionSpan.cs +++ b/src/Compilers/Core/Portable/Text/LinePositionSpan.cs @@ -23,7 +23,7 @@ public LinePositionSpan(LinePosition start, LinePosition end) { if (end < start) { - throw new ArgumentException("end", CodeAnalysisResources.EndMustNotBeLessThanStart); + throw new ArgumentException(CodeAnalysisResources.EndMustNotBeLessThanStart, nameof(end)); } _start = start; diff --git a/src/Compilers/Test/Utilities/CSharp/Extensions.cs b/src/Compilers/Test/Utilities/CSharp/Extensions.cs index 07c51fcb12a55ae5254a13d4d8b9fe501ca22843..9e754c558677fa1e11d897be5c5e7bd59f229f19 100644 --- a/src/Compilers/Test/Utilities/CSharp/Extensions.cs +++ b/src/Compilers/Test/Utilities/CSharp/Extensions.cs @@ -41,7 +41,7 @@ public static SyntaxNodeOrToken FindNodeOrTokenByKind(this SyntaxTree syntaxTree { if (!(occurrence > 0)) { - throw new ArgumentException("Specified value must be greater than zero.", "occurrence"); + throw new ArgumentException("Specified value must be greater than zero.", nameof(occurrence)); } SyntaxNodeOrToken foundNode = default(SyntaxNodeOrToken); if (TryFindNodeOrToken(syntaxTree.GetCompilationUnitRoot(), kind, ref occurrence, ref foundNode)) diff --git a/src/Compilers/Test/Utilities/Core2/DirectoryHelper.cs b/src/Compilers/Test/Utilities/Core2/DirectoryHelper.cs index cf31b3e5fe2f6bcdb47d9c8f07bb33485298943a..36d4d660147f237d45a6c255192bf7a19f480055 100644 --- a/src/Compilers/Test/Utilities/Core2/DirectoryHelper.cs +++ b/src/Compilers/Test/Utilities/Core2/DirectoryHelper.cs @@ -16,7 +16,7 @@ public DirectoryHelper(string path) { if (!Directory.Exists(path)) { - throw new ArgumentException("Directory '" + path + "' does not exist.", "path"); + throw new ArgumentException("Directory '" + path + "' does not exist.", nameof(path)); } _rootPath = path; diff --git a/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmDataContainer.cs b/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmDataContainer.cs index fee651892a659f4f59fb3d4eb410386401029c28..0abc35a500d489dc324371bfce2922066b65f99a 100644 --- a/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmDataContainer.cs +++ b/src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmDataContainer.cs @@ -35,7 +35,7 @@ public abstract class DkmDataContainer { if (_dataItems.ContainsKey(key)) { - throw new ArgumentException("Data item already exists", "item"); + throw new ArgumentException("Data item already exists", nameof(item)); } } diff --git a/src/Scripting/Core/InteractiveAssemblyLoader.cs b/src/Scripting/Core/InteractiveAssemblyLoader.cs index 18a621659027d12528814c5c654a73a3cf5f7b70..87f1da989c4ac6afcb0b9ab2c6305915c08b1115 100644 --- a/src/Scripting/Core/InteractiveAssemblyLoader.cs +++ b/src/Scripting/Core/InteractiveAssemblyLoader.cs @@ -148,7 +148,7 @@ public AssemblyLoadResult LoadFromPath(string path) if (!PathUtilities.IsAbsolute(path)) { - throw new ArgumentException("Path must be absolute", "path"); + throw new ArgumentException("Path must be absolute", nameof(path)); } try diff --git a/src/Scripting/Test/ScriptEngine.cs b/src/Scripting/Test/ScriptEngine.cs index d4f095362c958e8dee7551641f69687684b11303..39fe0e19a249322b9cb55162c98dc3c8bcca9db6 100644 --- a/src/Scripting/Test/ScriptEngine.cs +++ b/src/Scripting/Test/ScriptEngine.cs @@ -303,7 +303,7 @@ internal static void ValidateNamespace(string @namespace) if (!@namespace.IsValidClrNamespaceName()) { - throw new ArgumentException("Invalid namespace name", "namespace"); + throw new ArgumentException("Invalid namespace name", nameof(@namespace)); } } diff --git a/src/Test/Utilities/DiagnosticExtensions.cs b/src/Test/Utilities/DiagnosticExtensions.cs index 9961c0a3c8eef8613a55758b81f6695b1792b27f..89ad18fa523c95dd46bd2cd8556e516bd045681e 100644 --- a/src/Test/Utilities/DiagnosticExtensions.cs +++ b/src/Test/Utilities/DiagnosticExtensions.cs @@ -64,7 +64,7 @@ private static void Verify(IEnumerable actual, DiagnosticDescription { if (expected == null) { - throw new ArgumentException("Must specify expected errors.", "expected"); + throw new ArgumentException("Must specify expected errors.", nameof(expected)); } var unmatched = actual.Select(d => new DiagnosticDescription(d, errorCodeOnly)).ToList(); diff --git a/src/Test/Utilities/TestHelpers.cs b/src/Test/Utilities/TestHelpers.cs index 392500a8d217ba9b5a2514e4b1b6ec67bb0354f0..83eaad763ed4ca4453091e7edd288e2114f8c987 100644 --- a/src/Test/Utilities/TestHelpers.cs +++ b/src/Test/Utilities/TestHelpers.cs @@ -14,7 +14,7 @@ public static IEnumerable GetAllTypesImplementingGivenInterface(Assembly a { if (assembly == null || interfaceType == null || !interfaceType.IsInterface) { - throw new ArgumentException("interfaceType is not an interface.", "interfaceType"); + throw new ArgumentException("interfaceType is not an interface.", nameof(interfaceType)); } return assembly.GetTypes().Where((t) =>