Removed CallerArgumentExpressionAttribute to fix support for dotnet 6 (#901)

### Motivation and Context
Build was failing on systems with dotnet 6 installed (and not dotnet 7)

### Description
Removed CallerArgumentExpressionAttribute and its usage.
This commit is contained in:
Adrian Bonar
2023-05-09 19:17:48 -07:00
committed by GitHub
parent c040103061
commit b24c7dc707
2 changed files with 5 additions and 4 deletions
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
@@ -21,3 +21,4 @@ internal sealed class CallerArgumentExpressionAttribute : Attribute
}
#endif
@@ -17,7 +17,7 @@ internal static class Verify
// Equivalent of ArgumentNullException.ThrowIfNull
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void NotNull([NotNull] object? obj, [CallerArgumentExpression(nameof(obj))] string? paramName = null)
internal static void NotNull([NotNull] object? obj, [CallerArgumentExpression("obj")] string? paramName = null)
{
if (obj is null)
{
@@ -26,7 +26,7 @@ internal static class Verify
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void NotNullOrWhiteSpace([NotNull] string? str, [CallerArgumentExpression(nameof(str))] string? paramName = null)
internal static void NotNullOrWhiteSpace([NotNull] string? str, [CallerArgumentExpression("str")] string? paramName = null)
{
NotNull(str, paramName);
if (string.IsNullOrWhiteSpace(str))
@@ -62,7 +62,7 @@ internal static class Verify
}
}
internal static void StartsWith(string text, string prefix, string message, [CallerArgumentExpression(nameof(text))] string? textParamName = null)
internal static void StartsWith(string text, string prefix, string message, [CallerArgumentExpression("text")] string? textParamName = null)
{
Debug.Assert(prefix is not null);