Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fixReconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
mregen committed Oct 10, 2024
2 parents 7e17720 + 23b8502 commit 28c820a
Show file tree
Hide file tree
Showing 52 changed files with 4,249 additions and 816 deletions.
4 changes: 2 additions & 2 deletions .azurepipelines/get-version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

try {
# Try install tool
# Note: Keep Version 3.6.141, it is known working for 4 digit versioning
& dotnet @("tool", "install", "--tool-path", "./tools", "--version", "3.6.141", "--framework", "net60", "nbgv") 2>&1
# Note: Keep Version 3.6.143, it is known working for 4 digit versioning
& dotnet @("tool", "install", "--tool-path", "./tools", "--version", "3.6.143", "--framework", "net60", "nbgv") 2>&1

$props = (& ./tools/nbgv @("get-version", "-f", "json")) | ConvertFrom-Json
if ($LastExitCode -ne 0) {
Expand Down
10 changes: 5 additions & 5 deletions Applications/ConsoleReferenceClient/ClientSamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ Task FetchReferenceIdTypesAsync(ISession session)

if (ServiceResult.IsNotBad(value.StatusCode))
{
var valueString = ClientSamples.FormatValueAsJson(uaClient.Session.MessageContext, variableId.ToString(), value, true);
var valueString = ClientSamples.FormatValueAsJson(uaClient.Session.MessageContext, variableId.ToString(), value, JsonEncodingType.Compact);
m_output.WriteLine(valueString);
}
else
Expand All @@ -992,7 +992,7 @@ Task FetchReferenceIdTypesAsync(ISession session)
{
if (ServiceResult.IsNotBad(errors[ii]))
{
var valueString = ClientSamples.FormatValueAsJson(uaClient.Session.MessageContext, variableIds[ii].ToString(), value, true);
var valueString = ClientSamples.FormatValueAsJson(uaClient.Session.MessageContext, variableIds[ii].ToString(), value, JsonEncodingType.Compact);
m_output.WriteLine(valueString);
}
else
Expand Down Expand Up @@ -1102,15 +1102,15 @@ public async Task SubscribeAllValuesAsync(
/// </summary>
/// <param name="name">The key of the Json value.</param>
/// <param name="value">The DataValue.</param>
/// <param name="jsonReversible">Use reversible encoding.</param>
/// <param name="jsonEncodingType">Use reversible encoding.</param>
public static string FormatValueAsJson(
IServiceMessageContext messageContext,
string name,
DataValue value,
bool jsonReversible)
JsonEncodingType jsonEncodingType)
{
string textbuffer;
using (var jsonEncoder = new JsonEncoder(messageContext, jsonReversible))
using (var jsonEncoder = new JsonEncoder(messageContext, jsonEncodingType))
{
jsonEncoder.WriteDataValue(name, value);
textbuffer = jsonEncoder.CloseAndReturnText();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="Serilog" Version="4.0.1" />
<PackageReference Include="Serilog" Version="4.0.2" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="Serilog" Version="4.0.1" />
<PackageReference Include="Serilog" Version="4.0.2" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- Where the application instance certificate is stored (MachineDefault) -->
<ApplicationCertificate>
<StoreType>Directory</StoreType>
<StorePath>%LocalApplicationData%/OPC Foundation/pki/own</StorePath>
<StorePath>%LocalApplicationData%/OPC Foundation/pki/own</StorePath>
<SubjectName>CN=Quickstart Reference Server, C=US, S=Arizona, O=OPC Foundation, DC=localhost</SubjectName>
</ApplicationCertificate>

Expand Down Expand Up @@ -77,6 +77,7 @@
<BaseAddresses>
<ua:String>opc.https://localhost:62540/Quickstarts/ReferenceServer</ua:String>
<ua:String>opc.tcp://localhost:62541/Quickstarts/ReferenceServer</ua:String>
<!--<ua:String>https://localhost:62542/Quickstarts/ReferenceServer</ua:String>-->
</BaseAddresses>
<!--
These list the alternate addresses (via firewalls, multiple NICs etc.) that can be
Expand Down
4 changes: 2 additions & 2 deletions Fuzzing/Encoders/Fuzz.Tests/Opc.Ua.Encoders.Fuzz.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit.Console" Version="3.18.1" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit.Console" Version="3.18.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion Fuzzing/Encoders/Fuzz.Tools/Encoders.Fuzz.Tools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PackageReference Include="SharpFuzz" Version="2.1.1" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Serilog" Version="4.0.1" />
<PackageReference Include="Serilog" Version="4.0.2" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
Expand Down
57 changes: 42 additions & 15 deletions Libraries/Opc.Ua.Client/DataDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -313,27 +314,53 @@ public byte[] ReadDictionary(NodeId dictionaryId)
// read value.
DataValueCollection values;
DiagnosticInfoCollection diagnosticInfos;
try
{
ResponseHeader responseHeader = m_session.Read(
null,
0,
TimestampsToReturn.Neither,
itemsToRead,
out values,
out diagnosticInfos);

ResponseHeader responseHeader = m_session.Read(
null,
0,
TimestampsToReturn.Neither,
itemsToRead,
out values,
out diagnosticInfos);
ClientBase.ValidateResponse(values, itemsToRead);
ClientBase.ValidateDiagnosticInfos(diagnosticInfos, itemsToRead);

ClientBase.ValidateResponse(values, itemsToRead);
ClientBase.ValidateDiagnosticInfos(diagnosticInfos, itemsToRead);
// check for error.
if (StatusCode.IsBad(values[0].StatusCode))
{
ServiceResult result = ClientBase.GetResult(values[0].StatusCode, 0, diagnosticInfos, responseHeader);
throw new ServiceResultException(result);
}

// check for error.
if (StatusCode.IsBad(values[0].StatusCode))
// return as a byte array.
return values[0].Value as byte[];

}
catch (ServiceResultException ex)
{
ServiceResult result = ClientBase.GetResult(values[0].StatusCode, 0, diagnosticInfos, responseHeader);
throw new ServiceResultException(result);
if (ex.StatusCode != StatusCodes.BadEncodingLimitsExceeded)
{
throw;
}
else
{
try
{
byte[] dictionary = m_session.ReadByteStringInChunks(dictionaryId);
return dictionary;
}
catch
{
ExceptionDispatchInfo.Capture(ex).Throw();
throw;
}

}
}

// return as a byte array.
return values[0].Value as byte[];

}

/// <summary>
Expand Down
7 changes: 7 additions & 0 deletions Libraries/Opc.Ua.Client/Session/ISession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,13 @@ Task<Dictionary<NodeId, DataDictionary>> LoadDataTypeSystem(
/// <param name="errors">The errors reported by the server.</param>
void ReadValues(IList<NodeId> nodeIds, out DataValueCollection values, out IList<ServiceResult> errors);

/// <summary>
/// Reads a byte string which is too large for the (server side) encoder to handle.
/// </summary>
/// <param name="nodeId">The node id of a byte string variable</param>
/// <returns></returns>
byte[] ReadByteStringInChunks(NodeId nodeId);

/// <summary>
/// Fetches all references for the specified node.
/// </summary>
Expand Down
Loading

0 comments on commit 28c820a

Please sign in to comment.