Skip to content

Commit

Permalink
Merge pull request #7291 from Particular/code-analysis-cleanup-9.2
Browse files Browse the repository at this point in the history
Code analysis cleanup 9.2
  • Loading branch information
jasontaylordev authored Feb 12, 2025
2 parents 902e7a3 + 4b481f0 commit 1a672a1
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 35 deletions.
26 changes: 13 additions & 13 deletions src/NServiceBus.Core.Tests/Serializers/XML/SerializerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -636,19 +636,19 @@ public void TestInterfaces()
};
o.Foos = new Dictionary<string, List<Foo>>
{
["foo1"] = new List<Foo>(new[]
{
new Foo
{
Name = "1",
Title = "1"
},
new Foo
{
Name = "2",
Title = "2"
}
})
["foo1"] = new List<Foo>(
[
new Foo
{
Name = "1",
Title = "1"
},
new Foo
{
Name = "2",
Title = "2"
}
])
};
o.Data =
[
Expand Down
4 changes: 2 additions & 2 deletions src/NServiceBus.Core/Features/Feature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected void DependsOnAtLeastOne(params Type[] features)
}
}

Dependencies.Add(new List<string>(features.Select(GetFeatureName)));
Dependencies.Add(features.Select(GetFeatureName).ToList());
}

/// <summary>
Expand Down Expand Up @@ -173,7 +173,7 @@ protected void DependsOnAtLeastOne(params string[] featureNames)
{
ArgumentNullException.ThrowIfNull(featureNames);

Dependencies.Add(new List<string>(featureNames));
Dependencies.Add([.. featureNames]);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/NServiceBus.Core/Hosting/Helpers/AssemblyScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static string RemoveExtension(string assemblyName) =>

internal IReadOnlyCollection<Type> TypesToSkip
{
set => typesToSkip = new HashSet<Type>(value);
set => typesToSkip = [.. value];
}

internal string AdditionalAssemblyScanningPath { get; set; }
Expand Down
13 changes: 6 additions & 7 deletions src/NServiceBus.Core/OpenTelemetry/Tracing/ActivityExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace NServiceBus;

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Extensibility;
Expand Down Expand Up @@ -38,13 +37,13 @@ public static void SetErrorStatus(this Activity activity, Exception ex)
activity.SetTag("otel.status_code", "ERROR");
activity.SetTag("otel.status_description", ex.Message);
activity.AddEvent(new ActivityEvent("exception", DateTimeOffset.UtcNow,
new ActivityTagsCollection(new[]
new ActivityTagsCollection
{
new KeyValuePair<string, object>("exception.escaped", true),
new KeyValuePair<string, object>("exception.type", ex.GetType()),
new KeyValuePair<string, object>("exception.message", ex.Message),
new KeyValuePair<string, object>("exception.stacktrace", ex.ToString()),
})));
{ "exception.escaped", true },
{ "exception.type", ex.GetType() },
{ "exception.message", ex.Message },
{ "exception.stacktrace", ex.ToString() }
}));

if (ex is TaskCanceledException)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ public interface IRecoverabilityActionContext : IBehaviorContext
/// <summary>
/// The message that failed processing.
/// </summary>
public IncomingMessage FailedMessage { get; }
IncomingMessage FailedMessage { get; }

/// <summary>
/// The exception that caused processing to fail.
/// </summary>
public Exception Exception { get; }
Exception Exception { get; }

/// <summary>
/// The receive address where this message failed.
/// </summary>
public string ReceiveAddress { get; }
string ReceiveAddress { get; }

/// <summary>
/// The number of times the message have been retried immediately but failed.
/// </summary>
public int ImmediateProcessingFailures { get; }
int ImmediateProcessingFailures { get; }

/// <summary>
/// Number of delayed deliveries performed so far.
/// </summary>
public int DelayedDeliveriesPerformed { get; }
int DelayedDeliveriesPerformed { get; }

/// <summary>
/// Metadata for this message.
Expand Down
12 changes: 6 additions & 6 deletions src/NServiceBus.Core/Recoverability/IRecoverabilityContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,32 @@ public interface IRecoverabilityContext : IBehaviorContext
/// <summary>
/// The message that failed processing.
/// </summary>
public IncomingMessage FailedMessage { get; }
IncomingMessage FailedMessage { get; }

/// <summary>
/// The exception that caused processing to fail.
/// </summary>
public Exception Exception { get; }
Exception Exception { get; }

/// <summary>
/// The receive address where this message failed.
/// </summary>
public string ReceiveAddress { get; }
string ReceiveAddress { get; }

/// <summary>
/// The number of times the message have been retried immediately but failed.
/// </summary>
public int ImmediateProcessingFailures { get; }
int ImmediateProcessingFailures { get; }

/// <summary>
/// Number of delayed deliveries performed so far.
/// </summary>
public int DelayedDeliveriesPerformed { get; }
int DelayedDeliveriesPerformed { get; }

/// <summary>
/// The recoverability configuration for the endpoint.
/// </summary>
public RecoverabilityConfig RecoverabilityConfiguration { get; }
RecoverabilityConfig RecoverabilityConfiguration { get; }

/// <summary>
/// The recoverability action to take for this message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public IRecoverabilityPipelineExecutor CreateRecoverabilityPipelineExecutor(
if (!settings.TryGet(PolicyOverride, out Func<RecoverabilityConfig, ErrorContext, RecoverabilityAction> policy))
{
policy = (config, context) => DefaultRecoverabilityPolicy.Invoke(config, context);
};
}

return new RecoverabilityPipelineExecutor<(RecoverabilityComponent,
Func<RecoverabilityConfig, ErrorContext, RecoverabilityAction>)>(
Expand Down

0 comments on commit 1a672a1

Please sign in to comment.