Skip to content

Commit 0c8492a

Browse files
authored
Merge pull request #1626 from bollhals/NRT
Add NRT for the whole client assembly
2 parents 946b4c2 + 83e5330 commit 0c8492a

File tree

101 files changed

+864
-801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+864
-801
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ dotnet_diagnostic.RS0026.severity = none
167167
dotnet_diagnostic.RS0027.severity = none
168168
dotnet_diagnostic.RS0036.severity = none
169169
dotnet_diagnostic.RS0041.severity = none
170-
dotnet_diagnostic.RS0051.severity = error
170+
dotnet_diagnostic.RS0051.severity = none
171171

172172
dotnet_diagnostic.CA2007.severity = error
173173

projects/Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<PackageVersion Include="Ductus.FluentDocker" Version="2.10.59" />
88
<PackageVersion Include="EasyNetQ.Management.Client" Version="2.0.0" />
99
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
10+
<PackageVersion Include="Nullable" Version="1.3.1" />
1011
<PackageVersion Include="OpenTelemetry.Api" Version="1.7.0" />
1112
<PackageVersion Include="OpenTelemetry.Exporter.InMemory" Version="1.8.0" />
1213
<!--

projects/RabbitMQ.Client/FrameworkExtension/DictionaryExtension.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
namespace RabbitMQ
3535
{
36-
#nullable enable
3736
#if NETSTANDARD
3837
internal static class DictionaryExtension
3938
{

projects/RabbitMQ.Client/RabbitMQ.Client.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
<!--
3333
https://learn.microsoft.com/en-us/answers/questions/1371494/for-net-standard-2-0-library-why-add-net-core-3-1
3434
https://devblogs.microsoft.com/dotnet/embracing-nullable-reference-types/#what-should-library-authors-do
35-
Note: only setting language version 8.0 for nullable reference types!
3635
-->
37-
<LangVersion>8.0</LangVersion>
36+
<LangVersion>9.0</LangVersion>
37+
<Nullable>enable</Nullable>
3838
</PropertyGroup>
3939

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

6970
<ItemGroup Condition="$(TargetFramework) == 'netstandard2.0'">

projects/RabbitMQ.Client/client/RentedMemory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void Dispose()
7070
if (RentedArray != null)
7171
{
7272
ArrayPool<byte>.Shared.Return(RentedArray);
73-
RentedArray = default;
73+
RentedArray = Array.Empty<byte>();
7474
Memory = default;
7575
}
7676
}

projects/RabbitMQ.Client/client/api/AmqpTcpEndpoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public static AmqpTcpEndpoint[] ParseMultiple(string addresses)
266266
/// <summary>
267267
/// Compares this instance by value (protocol, hostname, port) against another instance.
268268
/// </summary>
269-
public override bool Equals(object obj)
269+
public override bool Equals(object? obj)
270270
{
271271
if (!(obj is AmqpTcpEndpoint other))
272272
{

projects/RabbitMQ.Client/client/api/AmqpTimestamp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public AmqpTimestamp(long unixTime) : this()
6666

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

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

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

projects/RabbitMQ.Client/client/api/AsyncDefaultBasicConsumer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public string[] ConsumerTags
4848
/// If our <see cref="IChannel"/> shuts down, this property will contain a description of the reason for the
4949
/// shutdown. Otherwise it will contain null. See <see cref="ShutdownEventArgs"/>.
5050
/// </summary>
51-
public ShutdownEventArgs ShutdownReason { get; protected set; }
51+
public ShutdownEventArgs? ShutdownReason { get; protected set; }
5252

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

6969
/// <summary>
7070
/// Called when the consumer is cancelled for reasons other than by a basicCancel:

projects/RabbitMQ.Client/client/api/BasicCredentialsProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class BasicCredentialsProvider : ICredentialsProvider
3939
private readonly string _userName;
4040
private readonly string _password;
4141

42-
public BasicCredentialsProvider(string name, string userName, string password)
42+
public BasicCredentialsProvider(string? name, string userName, string password)
4343
{
4444
_name = name ?? string.Empty;
4545
_userName = userName ?? throw new ArgumentNullException(nameof(userName));

projects/RabbitMQ.Client/client/api/BasicProperties.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131

3232
using System;
3333
using System.Collections.Generic;
34+
using System.Diagnostics.CodeAnalysis;
3435
using RabbitMQ.Client.Framing.Impl;
3536
using RabbitMQ.Client.Impl;
3637

3738
namespace RabbitMQ.Client
3839
{
39-
#nullable enable
4040
/// <summary>
4141
/// AMQP specification content header properties for content class "basic".
4242
/// </summary>
@@ -74,7 +74,7 @@ public PublicationAddress? ReplyToAddress
7474
{
7575
get
7676
{
77-
PublicationAddress.TryParse(ReplyTo, out PublicationAddress result);
77+
PublicationAddress.TryParse(ReplyTo, out PublicationAddress? result);
7878
return result;
7979
}
8080

@@ -118,19 +118,30 @@ public BasicProperties(IReadOnlyBasicProperties input)
118118
public void ClearAppId() => AppId = default;
119119
public void ClearClusterId() => ClusterId = default;
120120

121+
[MemberNotNullWhen(true, nameof(ContentType))]
121122
public bool IsContentTypePresent() => ContentType != default;
123+
[MemberNotNullWhen(true, nameof(ContentEncoding))]
122124
public bool IsContentEncodingPresent() => ContentEncoding != default;
125+
[MemberNotNullWhen(true, nameof(Headers))]
123126
public bool IsHeadersPresent() => Headers != default;
124127
public bool IsDeliveryModePresent() => DeliveryMode != default;
125128
public bool IsPriorityPresent() => Priority != default;
129+
[MemberNotNullWhen(true, nameof(CorrelationId))]
126130
public bool IsCorrelationIdPresent() => CorrelationId != default;
131+
[MemberNotNullWhen(true, nameof(ReplyTo))]
127132
public bool IsReplyToPresent() => ReplyTo != default;
133+
[MemberNotNullWhen(true, nameof(Expiration))]
128134
public bool IsExpirationPresent() => Expiration != default;
135+
[MemberNotNullWhen(true, nameof(MessageId))]
129136
public bool IsMessageIdPresent() => MessageId != default;
130137
public bool IsTimestampPresent() => Timestamp != default;
138+
[MemberNotNullWhen(true, nameof(Type))]
131139
public bool IsTypePresent() => Type != default;
140+
[MemberNotNullWhen(true, nameof(UserId))]
132141
public bool IsUserIdPresent() => UserId != default;
142+
[MemberNotNullWhen(true, nameof(AppId))]
133143
public bool IsAppIdPresent() => AppId != default;
144+
[MemberNotNullWhen(true, nameof(ClusterId))]
134145
public bool IsClusterIdPresent() => ClusterId != default;
135146

136147
ushort IAmqpHeader.ProtocolClassId => ClassConstants.Basic;

0 commit comments

Comments
 (0)