Skip to content

Commit

Permalink
Merge pull request #1626 from bollhals/NRT
Browse files Browse the repository at this point in the history
Add NRT for the whole client assembly
  • Loading branch information
lukebakken authored Jul 9, 2024
2 parents 946b4c2 + 83e5330 commit 0c8492a
Show file tree
Hide file tree
Showing 101 changed files with 864 additions and 801 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ dotnet_diagnostic.RS0026.severity = none
dotnet_diagnostic.RS0027.severity = none
dotnet_diagnostic.RS0036.severity = none
dotnet_diagnostic.RS0041.severity = none
dotnet_diagnostic.RS0051.severity = error
dotnet_diagnostic.RS0051.severity = none

dotnet_diagnostic.CA2007.severity = error

Expand Down
1 change: 1 addition & 0 deletions projects/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<PackageVersion Include="Ductus.FluentDocker" Version="2.10.59" />
<PackageVersion Include="EasyNetQ.Management.Client" Version="2.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Nullable" Version="1.3.1" />
<PackageVersion Include="OpenTelemetry.Api" Version="1.7.0" />
<PackageVersion Include="OpenTelemetry.Exporter.InMemory" Version="1.8.0" />
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

namespace RabbitMQ
{
#nullable enable
#if NETSTANDARD
internal static class DictionaryExtension
{
Expand Down
5 changes: 3 additions & 2 deletions projects/RabbitMQ.Client/RabbitMQ.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<!--
https://learn.microsoft.com/en-us/answers/questions/1371494/for-net-standard-2-0-library-why-add-net-core-3-1
https://devblogs.microsoft.com/dotnet/embracing-nullable-reference-types/#what-should-library-authors-do
Note: only setting language version 8.0 for nullable reference types!
-->
<LangVersion>8.0</LangVersion>
<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release' And '$(CI)' == 'true'">
Expand Down Expand Up @@ -64,6 +64,7 @@
See https://github.com/rabbitmq/rabbitmq-dotnet-client/pull/1481#pullrequestreview-1847905299
-->
<PackageReference Include="System.IO.Pipelines" />
<PackageReference Include="Nullable" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'netstandard2.0'">
Expand Down
2 changes: 1 addition & 1 deletion projects/RabbitMQ.Client/client/RentedMemory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void Dispose()
if (RentedArray != null)
{
ArrayPool<byte>.Shared.Return(RentedArray);
RentedArray = default;
RentedArray = Array.Empty<byte>();
Memory = default;
}
}
Expand Down
2 changes: 1 addition & 1 deletion projects/RabbitMQ.Client/client/api/AmqpTcpEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public static AmqpTcpEndpoint[] ParseMultiple(string addresses)
/// <summary>
/// Compares this instance by value (protocol, hostname, port) against another instance.
/// </summary>
public override bool Equals(object obj)
public override bool Equals(object? obj)
{
if (!(obj is AmqpTcpEndpoint other))
{
Expand Down
2 changes: 1 addition & 1 deletion projects/RabbitMQ.Client/client/api/AmqpTimestamp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public AmqpTimestamp(long unixTime) : this()

public bool Equals(AmqpTimestamp other) => UnixTime == other.UnixTime;

public override bool Equals(object obj) => obj is AmqpTimestamp other && Equals(other);
public override bool Equals(object? obj) => obj is AmqpTimestamp other && Equals(other);

public override int GetHashCode() => UnixTime.GetHashCode();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public string[] ConsumerTags
/// If our <see cref="IChannel"/> shuts down, this property will contain a description of the reason for the
/// shutdown. Otherwise it will contain null. See <see cref="ShutdownEventArgs"/>.
/// </summary>
public ShutdownEventArgs ShutdownReason { get; protected set; }
public ShutdownEventArgs? ShutdownReason { get; protected set; }

/// <summary>
/// Signalled when the consumer gets cancelled.
Expand All @@ -64,7 +64,7 @@ public event AsyncEventHandler<ConsumerEventArgs> ConsumerCancelled
/// Retrieve the <see cref="IChannel"/> this consumer is associated with,
/// for use in acknowledging received messages, for instance.
/// </summary>
public IChannel Channel { get; set; }
public IChannel? Channel { get; set; }

/// <summary>
/// Called when the consumer is cancelled for reasons other than by a basicCancel:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class BasicCredentialsProvider : ICredentialsProvider
private readonly string _userName;
private readonly string _password;

public BasicCredentialsProvider(string name, string userName, string password)
public BasicCredentialsProvider(string? name, string userName, string password)
{
_name = name ?? string.Empty;
_userName = userName ?? throw new ArgumentNullException(nameof(userName));
Expand Down
15 changes: 13 additions & 2 deletions projects/RabbitMQ.Client/client/api/BasicProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using RabbitMQ.Client.Framing.Impl;
using RabbitMQ.Client.Impl;

namespace RabbitMQ.Client
{
#nullable enable
/// <summary>
/// AMQP specification content header properties for content class "basic".
/// </summary>
Expand Down Expand Up @@ -74,7 +74,7 @@ public PublicationAddress? ReplyToAddress
{
get
{
PublicationAddress.TryParse(ReplyTo, out PublicationAddress result);
PublicationAddress.TryParse(ReplyTo, out PublicationAddress? result);
return result;
}

Expand Down Expand Up @@ -118,19 +118,30 @@ public BasicProperties(IReadOnlyBasicProperties input)
public void ClearAppId() => AppId = default;
public void ClearClusterId() => ClusterId = default;

[MemberNotNullWhen(true, nameof(ContentType))]
public bool IsContentTypePresent() => ContentType != default;
[MemberNotNullWhen(true, nameof(ContentEncoding))]
public bool IsContentEncodingPresent() => ContentEncoding != default;
[MemberNotNullWhen(true, nameof(Headers))]
public bool IsHeadersPresent() => Headers != default;
public bool IsDeliveryModePresent() => DeliveryMode != default;
public bool IsPriorityPresent() => Priority != default;
[MemberNotNullWhen(true, nameof(CorrelationId))]
public bool IsCorrelationIdPresent() => CorrelationId != default;
[MemberNotNullWhen(true, nameof(ReplyTo))]
public bool IsReplyToPresent() => ReplyTo != default;
[MemberNotNullWhen(true, nameof(Expiration))]
public bool IsExpirationPresent() => Expiration != default;
[MemberNotNullWhen(true, nameof(MessageId))]
public bool IsMessageIdPresent() => MessageId != default;
public bool IsTimestampPresent() => Timestamp != default;
[MemberNotNullWhen(true, nameof(Type))]
public bool IsTypePresent() => Type != default;
[MemberNotNullWhen(true, nameof(UserId))]
public bool IsUserIdPresent() => UserId != default;
[MemberNotNullWhen(true, nameof(AppId))]
public bool IsAppIdPresent() => AppId != default;
[MemberNotNullWhen(true, nameof(ClusterId))]
public bool IsClusterIdPresent() => ClusterId != default;

ushort IAmqpHeader.ProtocolClassId => ClassConstants.Basic;
Expand Down
6 changes: 4 additions & 2 deletions projects/RabbitMQ.Client/client/api/BinaryTableValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
// Copyright (c) 2007-2024 Broadcom. All Rights Reserved.
//---------------------------------------------------------------------------

using System;

namespace RabbitMQ.Client
{
/// <summary>Wrapper for a byte[]. May appear as values read from
Expand Down Expand Up @@ -61,9 +63,9 @@ namespace RabbitMQ.Client
public class BinaryTableValue
{
/// <summary>
/// Creates a new instance of the <see cref="BinaryTableValue"/> with null for its Bytes property.
/// Creates a new instance of the <see cref="BinaryTableValue"/> with an empty array for its Bytes property.
/// </summary>
public BinaryTableValue() : this(null)
public BinaryTableValue() : this(Array.Empty<byte>())
{
}

Expand Down
3 changes: 1 addition & 2 deletions projects/RabbitMQ.Client/client/api/ConnectionConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

namespace RabbitMQ.Client
{
#nullable enable
/// <summary>
/// The configuration of a connection.
/// </summary>
Expand Down Expand Up @@ -151,7 +150,7 @@ public sealed class ConnectionConfig
internal readonly Func<AmqpTcpEndpoint, CancellationToken, Task<IFrameHandler>> FrameHandlerFactoryAsync;

internal ConnectionConfig(string virtualHost, string userName, string password,
ICredentialsProvider credentialsProvider, ICredentialsRefresher credentialsRefresher,
ICredentialsProvider? credentialsProvider, ICredentialsRefresher credentialsRefresher,
IEnumerable<IAuthMechanismFactory> authMechanisms,
IDictionary<string, object?> clientProperties, string? clientProvidedName,
ushort maxChannelCount, uint maxFrameSize, uint maxInboundMessageBodySize, bool topologyRecoveryEnabled,
Expand Down
Loading

0 comments on commit 0c8492a

Please sign in to comment.