diff --git a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet6_0.verified.md b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet6_0.verified.md index 2982372..67bf1bb 100644 --- a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet6_0.verified.md +++ b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet6_0.verified.md @@ -93,7 +93,7 @@ ) : void [NullableContext, AssertionMethod, ContractAnnotation] - Fail.IfArgumentWhiteSpace( argumentValue: string [CanBeNull, AssertionCondition], - argumentName: string [NotNull, NotNull] + argumentName: string? [Nullable, CallerArgumentExpression, Optional] ) : void [AssertionMethod, ContractAnnotation] - Fail.IfCollectionContains( collection: IEnumerable [CanBeNull, AssertionCondition], diff --git a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet7_0.verified.md b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet7_0.verified.md index 501cd40..9d9e0d5 100644 --- a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet7_0.verified.md +++ b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet7_0.verified.md @@ -93,7 +93,7 @@ ) : void [NullableContext, AssertionMethod, ContractAnnotation] - Fail.IfArgumentWhiteSpace( argumentValue: string [CanBeNull, AssertionCondition], - argumentName: string [NotNull, NotNull] + argumentName: string? [Nullable, CallerArgumentExpression, Optional] ) : void [AssertionMethod, ContractAnnotation] - Fail.IfCollectionContains( collection: IEnumerable [CanBeNull, AssertionCondition], diff --git a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet8_0.verified.md b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet8_0.verified.md index 501cd40..9d9e0d5 100644 --- a/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet8_0.verified.md +++ b/Contracts/Synergy.Contracts.Test/Architecture/Public/Api.of.Synergy.Contracts.DotNet8_0.verified.md @@ -93,7 +93,7 @@ ) : void [NullableContext, AssertionMethod, ContractAnnotation] - Fail.IfArgumentWhiteSpace( argumentValue: string [CanBeNull, AssertionCondition], - argumentName: string [NotNull, NotNull] + argumentName: string? [Nullable, CallerArgumentExpression, Optional] ) : void [AssertionMethod, ContractAnnotation] - Fail.IfCollectionContains( collection: IEnumerable [CanBeNull, AssertionCondition], diff --git a/Contracts/Synergy.Contracts.Test/Failures/Doubles/Contractor.cs b/Contracts/Synergy.Contracts.Test/Failures/Doubles/Contractor.cs index a6b8643..5db8a0b 100644 --- a/Contracts/Synergy.Contracts.Test/Failures/Doubles/Contractor.cs +++ b/Contracts/Synergy.Contracts.Test/Failures/Doubles/Contractor.cs @@ -19,10 +19,10 @@ public static Contractor CreateCompany([NotNull] string name) } [NotNull, Pure] - public static Contractor CreatePerson([NotNull] string firstName, [NotNull] string lastName) + public static Contractor CreatePerson(string firstName, string lastName) { Fail.IfArgumentEmpty(firstName); - Fail.IfArgumentWhiteSpace(lastName, nameof(lastName)); + Fail.IfArgumentWhiteSpace(lastName); return new Contractor() { diff --git a/Contracts/Synergy.Contracts.Test/Failures/FailStringTest.cs b/Contracts/Synergy.Contracts.Test/Failures/FailStringTest.cs index 7df9726..f5ae40b 100644 Binary files a/Contracts/Synergy.Contracts.Test/Failures/FailStringTest.cs and b/Contracts/Synergy.Contracts.Test/Failures/FailStringTest.cs differ diff --git a/Contracts/Synergy.Contracts/Failures/FailString.cs b/Contracts/Synergy.Contracts/Failures/FailString.cs index 3a86a6e..6e5fdbb 100644 --- a/Contracts/Synergy.Contracts/Failures/FailString.cs +++ b/Contracts/Synergy.Contracts/Failures/FailString.cs @@ -85,7 +85,13 @@ public static void IfEmpty( [ContractAnnotation("argumentValue: null => halt")] public static void IfArgumentWhiteSpace( [CanBeNull, AssertionCondition(AssertionConditionType.IS_NOT_NULL)] string argumentValue, - [NotNull] [System.Diagnostics.CodeAnalysis.NotNull] string argumentName) +#if NET6_0_OR_GREATER + [System.Runtime.CompilerServices.CallerArgumentExpression("argumentValue")] + string? argumentName = null +#else + string argumentName +#endif + ) { Fail.RequiresArgumentName(argumentName); Fail.IfArgumentNull(argumentValue, argumentName);