diff --git a/.editorconfig b/.editorconfig index fe571bfed3d..a72f279574a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -218,6 +218,8 @@ dotnet_diagnostic.RCS1264.severity = none dotnet_diagnostic.IDE0011.severity = warning # Use collection initializers or expressions. dotnet_diagnostic.IDE0028.severity = warning +# Use null propagation. +dotnet_diagnostic.IDE0031.severity = warning # Note: There is some overlap with RCS1146. # Order modifiers. dotnet_diagnostic.IDE0036.severity = warning # Use inferred member names. @@ -295,9 +297,8 @@ dotnet_diagnostic.RCS1097.severity = warning # Mark local variable as const. dotnet_diagnostic.RCS1118.severity = warning # Use conditional access. -dotnet_diagnostic.RCS1146.severity = warning +dotnet_diagnostic.RCS1146.severity = warning # Note: There is some overlap with IDE0031. roslynator_null_conditional_operator.avoid_negative_boolean_comparison = true -dotnet_diagnostic.IDE0031.severity = none # Abstract type should not have public constructors. dotnet_diagnostic.RCS1160.severity = warning # Unused parameter. diff --git a/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/OperationPlanContext.Pooling.cs b/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/OperationPlanContext.Pooling.cs index d2d1c9eb509..b897dc63a7c 100644 --- a/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/OperationPlanContext.Pooling.cs +++ b/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/OperationPlanContext.Pooling.cs @@ -103,11 +103,9 @@ public async ValueTask DisposeAsync() _disposed = true; await _clientScope.DisposeAsync(); - if (_pool is not null) - { - _pool.Return(this); - _pool = null; - } + var pool = _pool; + _pool = null; + pool?.Return(this); } } diff --git a/src/Mocha/src/Mocha.Transport.Postgres/Connection/PostgresNotificationListener.cs b/src/Mocha/src/Mocha.Transport.Postgres/Connection/PostgresNotificationListener.cs index 91dd101f624..5428e1eadaa 100644 --- a/src/Mocha/src/Mocha.Transport.Postgres/Connection/PostgresNotificationListener.cs +++ b/src/Mocha/src/Mocha.Transport.Postgres/Connection/PostgresNotificationListener.cs @@ -106,10 +106,7 @@ private async Task ListenAsync(CancellationToken cancellationToken) } finally { - if (_connection is not null) - { - _connection.Notification -= OnNotification; - } + _connection?.Notification -= OnNotification; } }