diff --git a/common.props b/common.props index 01446b4181..67a8216d30 100644 --- a/common.props +++ b/common.props @@ -42,8 +42,8 @@ - - + + diff --git a/src/Azure.IIoT.OpcUa.Publisher.Models/src/Azure.IIoT.OpcUa.Publisher.Models.csproj b/src/Azure.IIoT.OpcUa.Publisher.Models/src/Azure.IIoT.OpcUa.Publisher.Models.csproj index 6a319356d0..77fca17161 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Models/src/Azure.IIoT.OpcUa.Publisher.Models.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Models/src/Azure.IIoT.OpcUa.Publisher.Models.csproj @@ -8,6 +8,6 @@ enable - + diff --git a/src/Azure.IIoT.OpcUa.Publisher.Models/tests/Azure.IIoT.OpcUa.Publisher.Models.Tests.csproj b/src/Azure.IIoT.OpcUa.Publisher.Models/tests/Azure.IIoT.OpcUa.Publisher.Models.Tests.csproj index c0029548ce..2a73809b6e 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Models/tests/Azure.IIoT.OpcUa.Publisher.Models.Tests.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Models/tests/Azure.IIoT.OpcUa.Publisher.Models.Tests.csproj @@ -6,18 +6,18 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers - - - + + + diff --git a/src/Azure.IIoT.OpcUa.Publisher.Module/cli/Azure.IIoT.OpcUa.Publisher.Module.Cli.csproj b/src/Azure.IIoT.OpcUa.Publisher.Module/cli/Azure.IIoT.OpcUa.Publisher.Module.Cli.csproj index 14083d2b9b..1f2d945d27 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Module/cli/Azure.IIoT.OpcUa.Publisher.Module.Cli.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Module/cli/Azure.IIoT.OpcUa.Publisher.Module.Cli.csproj @@ -4,8 +4,8 @@ net8.0 - - + + diff --git a/src/Azure.IIoT.OpcUa.Publisher.Module/src/Azure.IIoT.OpcUa.Publisher.Module.csproj b/src/Azure.IIoT.OpcUa.Publisher.Module/src/Azure.IIoT.OpcUa.Publisher.Module.csproj index f3bc184861..d5a4e3e683 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Module/src/Azure.IIoT.OpcUa.Publisher.Module.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Module/src/Azure.IIoT.OpcUa.Publisher.Module.csproj @@ -33,18 +33,18 @@ - - - - - + + + + + - - + + diff --git a/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Azure.IIoT.OpcUa.Publisher.Module.Tests.csproj b/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Azure.IIoT.OpcUa.Publisher.Module.Tests.csproj index cdd1d4bd37..5d2b0cd128 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Azure.IIoT.OpcUa.Publisher.Module.Tests.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Azure.IIoT.OpcUa.Publisher.Module.Tests.csproj @@ -3,19 +3,19 @@ net8.0 - + - + - - + + all runtime; build; native; contentfiles; analyzers - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Fixtures/PublisherIntegrationTestBase.cs b/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Fixtures/PublisherIntegrationTestBase.cs index 4874afa5d8..1fa83b8fc0 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Fixtures/PublisherIntegrationTestBase.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Fixtures/PublisherIntegrationTestBase.cs @@ -23,6 +23,7 @@ namespace Azure.IIoT.OpcUa.Publisher.Module.Tests.Fixtures using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; + using System.Buffers; /// /// Json message diff --git a/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Fixtures/PublisherModule.cs b/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Fixtures/PublisherModule.cs index a3f7e5f7cc..ccf2614617 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Fixtures/PublisherModule.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Module/tests/Fixtures/PublisherModule.cs @@ -45,6 +45,7 @@ namespace Azure.IIoT.OpcUa.Publisher.Module.Tests.Fixtures using System.Threading.Channels; using System.Threading.Tasks; using Xunit.Abstractions; + using System.Buffers; /// /// Publisher telemetry @@ -57,7 +58,7 @@ namespace Azure.IIoT.OpcUa.Publisher.Module.Tests.Fixtures /// /// public sealed record class PublisherTelemetry(string DeviceId, string ModuleId, - string Topic, ReadOnlyMemory Data, string ContentType, string ContentEncoding, + string Topic, ReadOnlySequence Data, string ContentType, string ContentEncoding, IReadOnlyDictionary Properties); /// @@ -506,7 +507,7 @@ internal IoTHubTelemetryHandler() } public ValueTask HandleAsync(string deviceId, string moduleId, string topic, - ReadOnlyMemory data, string contentType, string contentEncoding, + ReadOnlySequence data, string contentType, string contentEncoding, IReadOnlyDictionary properties, CancellationToken ct) { return _channel.Writer.WriteAsync(new PublisherTelemetry( @@ -529,7 +530,7 @@ internal EventConsumer() _channel = Channel.CreateUnbounded(); } - public async Task HandleAsync(string topic, ReadOnlyMemory data, + public async Task HandleAsync(string topic, ReadOnlySequence data, string contentType, IReadOnlyDictionary properties, IEventClient responder = null, CancellationToken ct = default) { diff --git a/src/Azure.IIoT.OpcUa.Publisher.Sdk/src/Azure.IIoT.OpcUa.Publisher.Sdk.csproj b/src/Azure.IIoT.OpcUa.Publisher.Sdk/src/Azure.IIoT.OpcUa.Publisher.Sdk.csproj index a2952d6da5..49aebcb25c 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Sdk/src/Azure.IIoT.OpcUa.Publisher.Sdk.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Sdk/src/Azure.IIoT.OpcUa.Publisher.Sdk.csproj @@ -8,9 +8,9 @@ enable - - - + + + diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/cli/Azure.IIoT.OpcUa.Publisher.Service.Cli.csproj b/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/cli/Azure.IIoT.OpcUa.Publisher.Service.Cli.csproj index 015d8d6048..7c6c7397e0 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/cli/Azure.IIoT.OpcUa.Publisher.Service.Cli.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/cli/Azure.IIoT.OpcUa.Publisher.Service.Cli.csproj @@ -14,8 +14,8 @@ - - + + diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk.csproj b/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk.csproj index d6ef3776b4..322a3a9a28 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk.csproj @@ -8,13 +8,13 @@ enable - - - - - - - + + + + + + + diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi.csproj b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi.csproj index 8f1dfd407c..27e0037e19 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi.csproj @@ -16,21 +16,21 @@ - - - - - + + + + + - + - + - - - + + + diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Azure.IIoT.OpcUa.Publisher.Service.WebApi.Tests.csproj b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Azure.IIoT.OpcUa.Publisher.Service.WebApi.Tests.csproj index 3a2abb1c9b..5e208a2bce 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Azure.IIoT.OpcUa.Publisher.Service.WebApi.Tests.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Azure.IIoT.OpcUa.Publisher.Service.WebApi.Tests.csproj @@ -3,20 +3,20 @@ net8.0 - - - + + + - - + + all runtime; build; native; contentfiles; analyzers - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service/src/Azure.IIoT.OpcUa.Publisher.Service.csproj b/src/Azure.IIoT.OpcUa.Publisher.Service/src/Azure.IIoT.OpcUa.Publisher.Service.csproj index 3074bc8ca7..9d1cc7ad0a 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service/src/Azure.IIoT.OpcUa.Publisher.Service.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Service/src/Azure.IIoT.OpcUa.Publisher.Service.csproj @@ -6,7 +6,7 @@ enable - + diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service/src/Handlers/DeviceTelemetryEventHandler.cs b/src/Azure.IIoT.OpcUa.Publisher.Service/src/Handlers/DeviceTelemetryEventHandler.cs index 676b811e04..987b250008 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service/src/Handlers/DeviceTelemetryEventHandler.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service/src/Handlers/DeviceTelemetryEventHandler.cs @@ -9,6 +9,7 @@ namespace Azure.IIoT.OpcUa.Publisher.Service.Handlers using Furly.Azure.IoT; using Furly.Extensions.Messaging; using System; + using System.Buffers; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; @@ -43,7 +44,7 @@ public IAwaiter GetAwaiter() /// public async ValueTask HandleAsync(string deviceId, string? moduleId, string topic, - ReadOnlyMemory data, string contentType, string contentEncoding, + ReadOnlySequence data, string contentType, string contentEncoding, IReadOnlyDictionary properties, CancellationToken ct) { diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service/tests/Azure.IIoT.OpcUa.Publisher.Service.Tests.csproj b/src/Azure.IIoT.OpcUa.Publisher.Service/tests/Azure.IIoT.OpcUa.Publisher.Service.Tests.csproj index 91eed8a9e2..ee5a081ed2 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service/tests/Azure.IIoT.OpcUa.Publisher.Service.Tests.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Service/tests/Azure.IIoT.OpcUa.Publisher.Service.Tests.csproj @@ -7,13 +7,13 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers diff --git a/src/Azure.IIoT.OpcUa.Publisher.Testing/src/Azure.IIoT.OpcUa.Publisher.Testing.Servers.csproj b/src/Azure.IIoT.OpcUa.Publisher.Testing/src/Azure.IIoT.OpcUa.Publisher.Testing.Servers.csproj index 768c83b7b8..b9408304fc 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Testing/src/Azure.IIoT.OpcUa.Publisher.Testing.Servers.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Testing/src/Azure.IIoT.OpcUa.Publisher.Testing.Servers.csproj @@ -55,8 +55,8 @@ - + - + diff --git a/src/Azure.IIoT.OpcUa.Publisher.Testing/tests/Azure.IIoT.OpcUa.Publisher.Testing.csproj b/src/Azure.IIoT.OpcUa.Publisher.Testing/tests/Azure.IIoT.OpcUa.Publisher.Testing.csproj index 780462df88..b996b50a93 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Testing/tests/Azure.IIoT.OpcUa.Publisher.Testing.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher.Testing/tests/Azure.IIoT.OpcUa.Publisher.Testing.csproj @@ -5,14 +5,14 @@ enable - - - - + + + + - + diff --git a/src/Azure.IIoT.OpcUa.Publisher/src/Azure.IIoT.OpcUa.Publisher.csproj b/src/Azure.IIoT.OpcUa.Publisher/src/Azure.IIoT.OpcUa.Publisher.csproj index f851a815e5..c4ac10b8d5 100644 --- a/src/Azure.IIoT.OpcUa.Publisher/src/Azure.IIoT.OpcUa.Publisher.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher/src/Azure.IIoT.OpcUa.Publisher.csproj @@ -7,10 +7,10 @@ - - - - + + + + diff --git a/src/Azure.IIoT.OpcUa.Publisher/src/Services/NetworkMessageEncoder.cs b/src/Azure.IIoT.OpcUa.Publisher/src/Services/NetworkMessageEncoder.cs index 0eab582ebc..2d3ad09df1 100644 --- a/src/Azure.IIoT.OpcUa.Publisher/src/Services/NetworkMessageEncoder.cs +++ b/src/Azure.IIoT.OpcUa.Publisher/src/Services/NetworkMessageEncoder.cs @@ -20,6 +20,7 @@ namespace Azure.IIoT.OpcUa.Publisher.Services using System.Diagnostics; using System.Diagnostics.Metrics; using System.Linq; + using System.Buffers; /// /// Creates PubSub encoded messages @@ -119,7 +120,7 @@ public void Dispose() .SetRetain(retain) .SetTtl(ttl) .SetQoS(qos) - .AddBuffers(chunks) + .AddBuffers(chunks.Select(m => new ReadOnlySequence(m))) ; if (_options.Value.UseStandardsCompliantEncoding != true) diff --git a/src/Azure.IIoT.OpcUa.Publisher/src/Services/RuntimeStateReporter.cs b/src/Azure.IIoT.OpcUa.Publisher/src/Services/RuntimeStateReporter.cs index d4947a1c19..cf2d24a8c6 100644 --- a/src/Azure.IIoT.OpcUa.Publisher/src/Services/RuntimeStateReporter.cs +++ b/src/Azure.IIoT.OpcUa.Publisher/src/Services/RuntimeStateReporter.cs @@ -481,7 +481,7 @@ private static void WriteDiagnosticsToConsole(IEnumerable<(string, WriterGroupDi Console.Out.WriteLine(builder.ToString()); } - StringBuilder Append(StringBuilder builder, string writerGroupId, + static StringBuilder Append(StringBuilder builder, string writerGroupId, WriterGroupDiagnosticModel info) { var s = info.IngestionDuration.TotalSeconds == 0 ? 1 : info.IngestionDuration.TotalSeconds; diff --git a/src/Azure.IIoT.OpcUa.Publisher/src/Stack/Services/OpcUaClient.cs b/src/Azure.IIoT.OpcUa.Publisher/src/Stack/Services/OpcUaClient.cs index 6adc8e8788..761a8666ef 100644 --- a/src/Azure.IIoT.OpcUa.Publisher/src/Stack/Services/OpcUaClient.cs +++ b/src/Azure.IIoT.OpcUa.Publisher/src/Stack/Services/OpcUaClient.cs @@ -2402,7 +2402,7 @@ private void NotifyAll(uint seq, ServiceResponse values, var missed = GetMissed(elapsed); values.ForEach(i => ((Sampler)i.Request.Handle).OnSample(seq, SetOverflow(i.Result, missed > 0), missed)); - DataValue SetOverflow(DataValue result, bool overflowBit) + static DataValue SetOverflow(DataValue result, bool overflowBit) { result.StatusCode.SetOverflow(overflowBit); return result; diff --git a/src/Azure.IIoT.OpcUa.Publisher/tests/Azure.IIoT.OpcUa.Publisher.Tests.csproj b/src/Azure.IIoT.OpcUa.Publisher/tests/Azure.IIoT.OpcUa.Publisher.Tests.csproj index 8a8f01bbcb..1304bd1caf 100644 --- a/src/Azure.IIoT.OpcUa.Publisher/tests/Azure.IIoT.OpcUa.Publisher.Tests.csproj +++ b/src/Azure.IIoT.OpcUa.Publisher/tests/Azure.IIoT.OpcUa.Publisher.Tests.csproj @@ -8,12 +8,12 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers diff --git a/src/Azure.IIoT.OpcUa.Publisher/tests/Services/Encoder/NetworkMessage.cs b/src/Azure.IIoT.OpcUa.Publisher/tests/Services/Encoder/NetworkMessage.cs index e9580528e7..70917d819b 100644 --- a/src/Azure.IIoT.OpcUa.Publisher/tests/Services/Encoder/NetworkMessage.cs +++ b/src/Azure.IIoT.OpcUa.Publisher/tests/Services/Encoder/NetworkMessage.cs @@ -12,7 +12,9 @@ namespace Azure.IIoT.OpcUa.Publisher.Tests.Services using Furly.Extensions.Messaging; using Opc.Ua; using System; + using System.Buffers; using System.Collections.Generic; + using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -76,9 +78,9 @@ public IEvent SetTtl(TimeSpan value) public IList> Buffers { get; } = new List>(); - public IEvent AddBuffers(IEnumerable> value) + public IEvent AddBuffers(IEnumerable> value) { - Buffers.AddRange(value); + Buffers.AddRange(value.Select(m => m.First)); return this; } @@ -90,6 +92,11 @@ public IEvent AddProperty(string name, string value) return this; } + public IEvent SetSchema(IEventSchema schema) + { + return this; + } + public static IEvent Create() { return new NetworkMessage(); @@ -258,5 +265,5 @@ public ValueTask SendAsync(CancellationToken ct = default) { return ValueTask.CompletedTask; } - } + } } diff --git a/src/Azure.IIoT.OpcUa.Publisher/tests/Services/RuntimeStateReporterTests.cs b/src/Azure.IIoT.OpcUa.Publisher/tests/Services/RuntimeStateReporterTests.cs index 9c4efad09b..23f2d0f0a4 100644 --- a/src/Azure.IIoT.OpcUa.Publisher/tests/Services/RuntimeStateReporterTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher/tests/Services/RuntimeStateReporterTests.cs @@ -16,6 +16,7 @@ namespace Azure.IIoT.OpcUa.Publisher.Tests.Services using Microsoft.Extensions.Configuration; using Moq; using System; + using System.Buffers; using System.Collections.Generic; using System.IO; using System.Linq; @@ -103,7 +104,7 @@ public async Task ReportingTest() var contentType = string.Empty; var contentEncoding = string.Empty; var routingInfo = string.Empty; - IReadOnlyList> buffers = null; + IReadOnlyList> buffers = null; _message.Setup(c => c.SetRetain(It.Is(v => v))) .Returns(_message.Object); _message.Setup(c => c.AddProperty(It.IsAny(), It.IsAny())) @@ -121,8 +122,8 @@ public async Task ReportingTest() _message.Setup(c => c.SetContentEncoding(It.IsAny())) .Callback(v => contentEncoding = v) .Returns(_message.Object); - _message.Setup(c => c.AddBuffers(It.IsAny>>())) - .Callback>>(v => buffers = v.ToList()) + _message.Setup(c => c.AddBuffers(It.IsAny>>())) + .Callback>>(v => buffers = v.ToList()) .Returns(_message.Object); _message.Setup(c => c.SetTopic(It.IsAny())) .Returns(_message.Object); @@ -156,7 +157,7 @@ await FluentActions Assert.Equal(Encoding.UTF8.WebName, contentEncoding); Assert.Single(buffers); - var body = Encoding.UTF8.GetString(buffers[0].Span); + var body = Encoding.UTF8.GetString(buffers[0].FirstSpan); Assert.StartsWith("{\"MessageType\":\"RestartAnnouncement\",\"MessageVersion\":1,\"TimestampUtc\":", body, StringComparison.Ordinal); } } diff --git a/src/Azure.IIoT.OpcUa/src/Azure.IIoT.OpcUa.csproj b/src/Azure.IIoT.OpcUa/src/Azure.IIoT.OpcUa.csproj index 1c6b023b64..f48892b298 100644 --- a/src/Azure.IIoT.OpcUa/src/Azure.IIoT.OpcUa.csproj +++ b/src/Azure.IIoT.OpcUa/src/Azure.IIoT.OpcUa.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/Azure.IIoT.OpcUa/tests/Azure.IIoT.OpcUa.Tests.csproj b/src/Azure.IIoT.OpcUa/tests/Azure.IIoT.OpcUa.Tests.csproj index a3fa9190cb..c228f7d3f5 100644 --- a/src/Azure.IIoT.OpcUa/tests/Azure.IIoT.OpcUa.Tests.csproj +++ b/src/Azure.IIoT.OpcUa/tests/Azure.IIoT.OpcUa.Tests.csproj @@ -4,17 +4,17 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers - + diff --git a/version.json b/version.json index 4cc7fe1e89..e4fefa30fe 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.9.4", + "version": "2.9.5", "publicReleaseRefSpec": [ "^refs/heads/main$", "^refs/heads/release/\\d+\\.\\d+\\.\\d+"