chore: Sonar Warnings

This commit is contained in:
Timothy Schenk 2023-11-06 10:49:14 +01:00
parent 2da3bc98cd
commit 821e3accb8
2 changed files with 2 additions and 5 deletions

View file

@ -14,7 +14,7 @@ using BenchmarkDotNet.Order;
[ThreadingDiagnoser] [ThreadingDiagnoser]
public class BinaryConversionBenchmarks public class BinaryConversionBenchmarks
{ {
private byte[] _data; private byte[] _data = null!;
private int _offset; private int _offset;
[GlobalSetup] [GlobalSetup]

View file

@ -29,13 +29,10 @@ public class PacketDistributorService : IHostedService
private readonly ILogger<PacketDistributorService> _logger; private readonly ILogger<PacketDistributorService> _logger;
private readonly ConcurrentDictionary<OperationCode, object> _packetHandlersInstantiation; private readonly ConcurrentDictionary<OperationCode, object> _packetHandlersInstantiation;
private readonly IServiceProvider _serviceProvider;
public PacketDistributorService(ILogger<PacketDistributorService> logger, IServiceProvider serviceProvider) public PacketDistributorService(ILogger<PacketDistributorService> logger, IServiceProvider serviceProvider)
{ {
this._concurrentQueue = new ConcurrentQueue<RawPacket>(); this._concurrentQueue = new ConcurrentQueue<RawPacket>();
this._logger = logger; this._logger = logger;
this._serviceProvider = serviceProvider;
var tempDeserializationMap = var tempDeserializationMap =
new Dictionary<OperationCode, Func<byte[], IPacket>>(); new Dictionary<OperationCode, Func<byte[], IPacket>>();
@ -46,7 +43,7 @@ public class PacketDistributorService : IHostedService
packetHandlers.ForEach(x => packetHandlers.ForEach(x =>
{ {
var packetHandler = var packetHandler =
ActivatorUtilities.GetServiceOrCreateInstance(this._serviceProvider, ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider,
x.Value); x.Value);
this._packetHandlersInstantiation.TryAdd(x.Key, packetHandler); this._packetHandlersInstantiation.TryAdd(x.Key, packetHandler);
}); });