Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<GlobalPackageReference Include="Roslynator.CodeAnalysis.Analyzers" Version="4.15.0" />
<GlobalPackageReference Include="Roslynator.CodeFixes" Version="4.15.0" />
<GlobalPackageReference Include="Roslynator.Refactorings" Version="4.15.0" />
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="10.27.0.140913" />
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="10.29.0.143774" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.9.0" />
Expand Down
2 changes: 2 additions & 0 deletions src/NetEvolve.Arguments/ArgumentNullExceptionPolyfills.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ public static void ThrowIfNull(
/// <param name="paramName">The name of the parameter with which <paramref name="argument"/> corresponds.</param>
/// <exception cref="ArgumentNullException"><paramref name="argument"/> is <see langword="null"/>.</exception>
/// <seealso href="https://learn.microsoft.com/en-us/dotnet/api/system.argumentnullexception.throwifnull?view=net-10.0#system-argumentnullexception-throwifnull(system-void*-system-string)" />
#pragma warning disable S6640 // Make sure that using "unsafe" is safe here.
public static unsafe void ThrowIfNull(
void* argument,
[CallerArgumentExpression(nameof(argument))] string? paramName = null
)
#pragma warning restore S6640 // Make sure that using "unsafe" is safe here.
{
if (argument is null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public async Task ThrowIfNull_String_WhenArgumentIsNotNull_DoesNotThrow()
}

[Test]
#pragma warning disable S6640 // Make sure that using "unsafe" is safe here.
public unsafe void ThrowIfNull_Pointer_WhenArgumentIsNull_ThrowsArgumentNullException()
#pragma warning restore S6640 // Make sure that using "unsafe" is safe here.
{
// Arrange
int* argument = null;
Expand All @@ -65,7 +67,9 @@ public unsafe void ThrowIfNull_Pointer_WhenArgumentIsNull_ThrowsArgumentNullExce
}

[Test]
#pragma warning disable S6640 // Make sure that using "unsafe" is safe here.
public unsafe void ThrowIfNull_Pointer_WhenArgumentIsNotNull_DoesNotThrow()
#pragma warning restore S6640 // Make sure that using "unsafe" is safe here.
{
// Arrange
var value = 42;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public async Task ThrowIfNull_WhenArgumentIsNotEmpty_ReturnsArgument()
}

[Test]
#pragma warning disable S6640 // Make sure that using "unsafe" is safe here.
public unsafe void ThrowIfNull_WhenArgumentIsNullPointer_ThrowsArgumentNullException()
#pragma warning restore S6640 // Make sure that using "unsafe" is safe here.
{
// Arrange
int* argument = null;
Expand Down