From 821e3accb881541b1a5731bf35cc2960b437b443 Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Mon, 6 Nov 2023 10:49:14 +0100 Subject: [PATCH] chore: Sonar Warnings --- Benchmarks/BinaryConversionBenchmarks.cs | 2 +- Server/Services/PacketDistributorService.cs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Benchmarks/BinaryConversionBenchmarks.cs b/Benchmarks/BinaryConversionBenchmarks.cs index f6d7eee..74cef4c 100644 --- a/Benchmarks/BinaryConversionBenchmarks.cs +++ b/Benchmarks/BinaryConversionBenchmarks.cs @@ -14,7 +14,7 @@ using BenchmarkDotNet.Order; [ThreadingDiagnoser] public class BinaryConversionBenchmarks { - private byte[] _data; + private byte[] _data = null!; private int _offset; [GlobalSetup] diff --git a/Server/Services/PacketDistributorService.cs b/Server/Services/PacketDistributorService.cs index 32175be..79f9c34 100644 --- a/Server/Services/PacketDistributorService.cs +++ b/Server/Services/PacketDistributorService.cs @@ -29,13 +29,10 @@ public class PacketDistributorService : IHostedService private readonly ILogger _logger; private readonly ConcurrentDictionary _packetHandlersInstantiation; - private readonly IServiceProvider _serviceProvider; - public PacketDistributorService(ILogger logger, IServiceProvider serviceProvider) { this._concurrentQueue = new ConcurrentQueue(); this._logger = logger; - this._serviceProvider = serviceProvider; var tempDeserializationMap = new Dictionary>(); @@ -46,7 +43,7 @@ public class PacketDistributorService : IHostedService packetHandlers.ForEach(x => { var packetHandler = - ActivatorUtilities.GetServiceOrCreateInstance(this._serviceProvider, + ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider, x.Value); this._packetHandlersInstantiation.TryAdd(x.Key, packetHandler); });