From 818240fcea5fd62e296c1ecf68211d46546264ab Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Wed, 16 Oct 2024 14:29:51 +0200 Subject: [PATCH] Fix nullability of parameter --- SystemExtensions.NetCore/Extensions/ObjectExtensions.cs | 2 +- SystemExtensions.NetCore/SystemExtensions.NetCore.csproj | 2 +- SystemExtensions.NetStandard/Extensions/ObjectExtensions.cs | 2 +- .../SystemExtensions.NetStandard.csproj | 2 +- SystemExtensions.Tests/Extensions/ObjectExtensionsTests.cs | 4 ++-- .../SystemExtensions.NetStandard.Tests.csproj | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/SystemExtensions.NetCore/Extensions/ObjectExtensions.cs b/SystemExtensions.NetCore/Extensions/ObjectExtensions.cs index bc2c2a5..046298d 100644 --- a/SystemExtensions.NetCore/Extensions/ObjectExtensions.cs +++ b/SystemExtensions.NetCore/Extensions/ObjectExtensions.cs @@ -5,7 +5,7 @@ namespace System.Core.Extensions; public static class ObjectExtensions { - public static T ThrowIfNull([NotNull] this T obj, [CallerArgumentExpression("obj")] string? paramName = null) + public static T ThrowIfNull([NotNull] this T? obj, [CallerArgumentExpression("obj")] string? paramName = null) where T : class { if (obj is null) diff --git a/SystemExtensions.NetCore/SystemExtensions.NetCore.csproj b/SystemExtensions.NetCore/SystemExtensions.NetCore.csproj index e2e5dac..6a2a13c 100644 --- a/SystemExtensions.NetCore/SystemExtensions.NetCore.csproj +++ b/SystemExtensions.NetCore/SystemExtensions.NetCore.csproj @@ -8,7 +8,7 @@ System LICENSE true - 1.6.10 + 1.6.11 Alexandru Macocian https://github.com/AlexMacocian/SystemExtensions Extensions for the System namespace diff --git a/SystemExtensions.NetStandard/Extensions/ObjectExtensions.cs b/SystemExtensions.NetStandard/Extensions/ObjectExtensions.cs index 0186319..0035c12 100644 --- a/SystemExtensions.NetStandard/Extensions/ObjectExtensions.cs +++ b/SystemExtensions.NetStandard/Extensions/ObjectExtensions.cs @@ -41,7 +41,7 @@ public static class ObjectExtensions return Optional.FromValue(obj); } - public static T ThrowIfNull([ValidatedNotNull] this T obj, string name) where T : class + public static T ThrowIfNull([ValidatedNotNull] this T? obj, string name) where T : class { if (obj is null) { diff --git a/SystemExtensions.NetStandard/SystemExtensions.NetStandard.csproj b/SystemExtensions.NetStandard/SystemExtensions.NetStandard.csproj index 136b079..4a5122c 100644 --- a/SystemExtensions.NetStandard/SystemExtensions.NetStandard.csproj +++ b/SystemExtensions.NetStandard/SystemExtensions.NetStandard.csproj @@ -7,7 +7,7 @@ LICENSE true System - 1.6.10 + 1.6.11 Alexandru Macocian https://github.com/AlexMacocian/SystemExtensions Extensions for the System namespace diff --git a/SystemExtensions.Tests/Extensions/ObjectExtensionsTests.cs b/SystemExtensions.Tests/Extensions/ObjectExtensionsTests.cs index 5ce18d5..94465f8 100644 --- a/SystemExtensions.Tests/Extensions/ObjectExtensionsTests.cs +++ b/SystemExtensions.Tests/Extensions/ObjectExtensionsTests.cs @@ -9,7 +9,7 @@ public class ObjectExtensionsTests [TestMethod] public void ThrowIfNull_NetCore_ThrowsWithCorrectName() { - object obj = null; + object? obj = null; try { System.Core.Extensions.ObjectExtensions.ThrowIfNull(obj); @@ -26,7 +26,7 @@ public class ObjectExtensionsTests [TestMethod] public void ThrowIfNull_NetStandard_ThrowsWithCorrectName() { - object obj = null; + object? obj = null; try { ObjectExtensions.ThrowIfNull(obj, nameof(obj)); diff --git a/SystemExtensions.Tests/SystemExtensions.NetStandard.Tests.csproj b/SystemExtensions.Tests/SystemExtensions.NetStandard.Tests.csproj index 6e14d26..34aa5db 100644 --- a/SystemExtensions.Tests/SystemExtensions.NetStandard.Tests.csproj +++ b/SystemExtensions.Tests/SystemExtensions.NetStandard.Tests.csproj @@ -2,7 +2,7 @@ net6.0 - + enable false