mirror of
https://github.com/evopro-ag/Sharp7Reactive.git
synced 2025-12-18 12:32:51 +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>
|
/// <param name="maxDegreeOfParallelism">The maximum degree of parallelism provided by this scheduler.</param>
|
||||||
public LimitedConcurrencyLevelTaskScheduler(int maxDegreeOfParallelism)
|
public LimitedConcurrencyLevelTaskScheduler(int maxDegreeOfParallelism)
|
||||||
{
|
{
|
||||||
if (maxDegreeOfParallelism < 1) throw new ArgumentOutOfRangeException("maxDegreeOfParallelism");
|
if (maxDegreeOfParallelism < 1) throw new ArgumentOutOfRangeException(nameof(maxDegreeOfParallelism));
|
||||||
this.maxDegreeOfParallelism = maxDegreeOfParallelism;
|
this.maxDegreeOfParallelism = maxDegreeOfParallelism;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace Sharp7.Rx;
|
namespace Sharp7.Rx;
|
||||||
|
|
||||||
public static class S7ErrorCodes
|
public static class S7ErrorCodes
|
||||||
@@ -7,12 +9,12 @@ public static class S7ErrorCodes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// This list is not exhaustive and should be considered work in progress.
|
/// This list is not exhaustive and should be considered work in progress.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly HashSet<int> notDisconnectedErrorCodes = new HashSet<int>
|
private static readonly HashSet<int> notDisconnectedErrorCodes =
|
||||||
{
|
[
|
||||||
0x000000, // OK
|
0x000000, // OK
|
||||||
0xC00000, // CPU: Item not available
|
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>
|
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
|
/// 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.
|
/// the DBs range. In this case the driver should not consider the connection to be lost.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool AssumeConnectionLost(int errorCode)
|
public static bool AssumeConnectionLost(int errorCode) =>
|
||||||
{
|
!notDisconnectedErrorCodes.Contains(errorCode);
|
||||||
return !notDisconnectedErrorCodes.Contains(errorCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string? GetAdditionalErrorText(int 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>
|
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||||
<IncludeSymbols>true</IncludeSymbols>
|
<IncludeSymbols>true</IncludeSymbols>
|
||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
<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>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -98,7 +98,9 @@ internal class Sharp7Connector : IS7Connector
|
|||||||
.Select(x =>
|
.Select(x =>
|
||||||
{
|
{
|
||||||
var buffer = new byte[x.Address.BufferLength];
|
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);
|
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};
|
return new {x.VariableName, Buffer = buffer};
|
||||||
})
|
})
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|||||||
@@ -230,8 +230,9 @@ public class Sharp7Plc : IPlc
|
|||||||
var min = performanceCounter.Min();
|
var min = performanceCounter.Min();
|
||||||
var max = performanceCounter.Max();
|
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}",
|
Logger?.LogTrace("PLC {Plc} notification perf: {Elements} calls, min {Min}, max {Max}, avg {Avg}, variables {Vars}, batch size {BatchSize}",
|
||||||
performanceCounter.Capacity, min, max, average, plcConnectionSettings.IpAddress,
|
plcConnectionSettings.IpAddress,
|
||||||
|
performanceCounter.Capacity, min, max, average,
|
||||||
multiVariableSubscriptions.ExistingKeys.Count(),
|
multiVariableSubscriptions.ExistingKeys.Count(),
|
||||||
MultiVarRequestMaxItems);
|
MultiVarRequestMaxItems);
|
||||||
performanceCounter.Clear();
|
performanceCounter.Clear();
|
||||||
|
|||||||
@@ -48,8 +48,7 @@ internal class VariableNameParser : IVariableNameParser
|
|||||||
|
|
||||||
public VariableAddress Parse(string input)
|
public VariableAddress Parse(string input)
|
||||||
{
|
{
|
||||||
if (input == null)
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
throw new ArgumentNullException(nameof(input));
|
|
||||||
|
|
||||||
var match = regex.Match(input);
|
var match = regex.Match(input);
|
||||||
if (!match.Success)
|
if (!match.Success)
|
||||||
|
|||||||
Reference in New Issue
Block a user