mirror of
https://github.com/evopro-ag/Sharp7Reactive.git
synced 2025-12-15 11:22:52 +00:00
Fix or ignore build warnings
This commit is contained in:
@@ -26,7 +26,7 @@ internal class LimitedConcurrencyLevelTaskScheduler : TaskScheduler
|
||||
/// <param name="maxDegreeOfParallelism">The maximum degree of parallelism provided by this scheduler.</param>
|
||||
public LimitedConcurrencyLevelTaskScheduler(int maxDegreeOfParallelism)
|
||||
{
|
||||
if (maxDegreeOfParallelism < 1) throw new ArgumentOutOfRangeException("maxDegreeOfParallelism");
|
||||
if (maxDegreeOfParallelism < 1) throw new ArgumentOutOfRangeException(nameof(maxDegreeOfParallelism));
|
||||
this.maxDegreeOfParallelism = maxDegreeOfParallelism;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#nullable enable
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Sharp7.Rx;
|
||||
|
||||
public static class S7ErrorCodes
|
||||
@@ -7,12 +9,12 @@ public static class S7ErrorCodes
|
||||
/// <summary>
|
||||
/// This list is not exhaustive and should be considered work in progress.
|
||||
/// </summary>
|
||||
private static readonly HashSet<int> notDisconnectedErrorCodes = new HashSet<int>
|
||||
{
|
||||
private static readonly HashSet<int> notDisconnectedErrorCodes =
|
||||
[
|
||||
0x000000, // OK
|
||||
0xC00000, // CPU: Item not available
|
||||
0x900000, // CPU: Address out of range
|
||||
};
|
||||
0x900000 // CPU: Address out of range
|
||||
];
|
||||
|
||||
private static readonly IReadOnlyDictionary<int, string> additionalErrorTexts = new Dictionary<int, string>
|
||||
{
|
||||
@@ -31,11 +33,9 @@ public static class S7ErrorCodes
|
||||
/// Other error codes indicate a user error, like reading from an unavailable DB or exceeding
|
||||
/// the DBs range. In this case the driver should not consider the connection to be lost.
|
||||
/// </summary>
|
||||
public static bool AssumeConnectionLost(int errorCode)
|
||||
{
|
||||
return !notDisconnectedErrorCodes.Contains(errorCode);
|
||||
}
|
||||
public static bool AssumeConnectionLost(int errorCode) =>
|
||||
!notDisconnectedErrorCodes.Contains(errorCode);
|
||||
|
||||
public static string? GetAdditionalErrorText(int errorCode) =>
|
||||
additionalErrorTexts.TryGetValue(errorCode, out var text) ? text : null;
|
||||
additionalErrorTexts.GetValueOrDefault(errorCode);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
|
||||
<!--
|
||||
CA1848: For improved performance, use the LoggerMessage delegates
|
||||
CA2254: The logging message template should not vary between calls
|
||||
CA1859: Change type of field 'xxx' from interface to type for performance reasons
|
||||
-->
|
||||
<NoWarn>$(NoWarn);CA1848;CA2254;CA1859</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -98,7 +98,9 @@ internal class Sharp7Connector : IS7Connector
|
||||
.Select(x =>
|
||||
{
|
||||
var buffer = new byte[x.Address.BufferLength];
|
||||
#pragma warning disable CS0618 // Type or member is obsolete, no matching overload.
|
||||
s7MultiVar.Add(S7Consts.S7AreaDB, S7Consts.S7WLByte, x.Address.DbNo, x.Address.Start, x.Address.BufferLength, ref buffer);
|
||||
#pragma warning restore CS0618
|
||||
return new {x.VariableName, Buffer = buffer};
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
@@ -230,8 +230,9 @@ public class Sharp7Plc : IPlc
|
||||
var min = performanceCounter.Min();
|
||||
var max = performanceCounter.Max();
|
||||
|
||||
Logger?.LogTrace("Performance statistic during {0} elements of plc notification. Min: {1}, Max: {2}, Average: {3}, Plc: '{4}', Number of variables: {5}, Batch size: {6}",
|
||||
performanceCounter.Capacity, min, max, average, plcConnectionSettings.IpAddress,
|
||||
Logger?.LogTrace("PLC {Plc} notification perf: {Elements} calls, min {Min}, max {Max}, avg {Avg}, variables {Vars}, batch size {BatchSize}",
|
||||
plcConnectionSettings.IpAddress,
|
||||
performanceCounter.Capacity, min, max, average,
|
||||
multiVariableSubscriptions.ExistingKeys.Count(),
|
||||
MultiVarRequestMaxItems);
|
||||
performanceCounter.Clear();
|
||||
|
||||
@@ -48,8 +48,7 @@ internal class VariableNameParser : IVariableNameParser
|
||||
|
||||
public VariableAddress Parse(string input)
|
||||
{
|
||||
if (input == null)
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
|
||||
var match = regex.Match(input);
|
||||
if (!match.Success)
|
||||
|
||||
Reference in New Issue
Block a user