diff --git a/ArchiSteamFarm/FixedSizeConcurrentQueue.cs b/ArchiSteamFarm/FixedSizeConcurrentQueue.cs index 7b7dedce3..820a009b3 100644 --- a/ArchiSteamFarm/FixedSizeConcurrentQueue.cs +++ b/ArchiSteamFarm/FixedSizeConcurrentQueue.cs @@ -31,6 +31,11 @@ namespace ArchiSteamFarm { internal byte MaxCount { get => _MaxCount; set { + if (value == 0) { + ASF.ArchiLogger.LogNullError(nameof(value)); + return; + } + _MaxCount = value; while ((BackingQueue.Count > MaxCount) && BackingQueue.TryDequeue(out _)) { } diff --git a/ArchiSteamFarm/HistoryTarget.cs b/ArchiSteamFarm/HistoryTarget.cs index 56ac6691d..c5a2ee952 100644 --- a/ArchiSteamFarm/HistoryTarget.cs +++ b/ArchiSteamFarm/HistoryTarget.cs @@ -51,9 +51,12 @@ namespace ArchiSteamFarm { } } - // This constructor is intentionally public, as NLog uses it for creating targets + // This parameterless(!) constructor is intentionally public, as NLog uses it for creating targets // It must stay like this as we want to have our targets defined in our NLog.config - public HistoryTarget(string name = null) => Name = name; + [SuppressMessage("ReSharper", "UnusedMember.Global")] + public HistoryTarget() { } + + internal HistoryTarget(string name = null) => Name = name; protected override void Write(LogEventInfo logEvent) { if (logEvent == null) { diff --git a/ArchiSteamFarm/SteamTarget.cs b/ArchiSteamFarm/SteamTarget.cs index 9d26e610a..9799cc87c 100644 --- a/ArchiSteamFarm/SteamTarget.cs +++ b/ArchiSteamFarm/SteamTarget.cs @@ -42,13 +42,10 @@ namespace ArchiSteamFarm { [RequiredParameter] public ulong SteamID { get; set; } - // This constructor is intentionally public, as NLog uses it for creating targets + // This parameterless(!) constructor is intentionally public, as NLog uses it for creating targets // It must stay like this as we want to have our targets defined in our NLog.config - // Keeping date in default layout also doesn't make much sense, so we remove it by default - public SteamTarget(string name = null) { - Name = name; - Layout = "${level:uppercase=true}|${logger}|${message}"; - } + // Keeping date in default layout also doesn't make much sense (Steam offers that), so we remove it by default + public SteamTarget() => Layout = "${level:uppercase=true}|${logger}|${message}"; protected override async void Write(LogEventInfo logEvent) { if (logEvent == null) {