Skip to content

Commit

Permalink
Merge with latest master
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsuciu committed May 21, 2024
2 parents a3d1469 + 91ef753 commit 7bcce20
Show file tree
Hide file tree
Showing 302 changed files with 9,780 additions and 3,623 deletions.
2 changes: 2 additions & 0 deletions .azurepipelines/signlistDebug.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Stack\Opc.Ua.Core\bin\Debug\netstandard2.0\Opc.Ua.Core.dll
Stack\Opc.Ua.Core\bin\Debug\netstandard2.1\Opc.Ua.Core.dll
Stack\Opc.Ua.Core\bin\Debug\net48\Opc.Ua.Core.dll
Stack\Opc.Ua.Core\bin\Debug\net6.0\Opc.Ua.Core.dll
Expand Down Expand Up @@ -30,6 +31,7 @@ Libraries\Opc.Ua.Gds.Server.Common\bin\Debug\netstandard2.1\Opc.Ua.Gds.Server.Co
Libraries\Opc.Ua.Gds.Server.Common\bin\Debug\net48\Opc.Ua.Gds.Server.Common.dll
Libraries\Opc.Ua.Gds.Server.Common\bin\Debug\net6.0\Opc.Ua.Gds.Server.Common.dll
Libraries\Opc.Ua.Gds.Server.Common\bin\Debug\net8.0\Opc.Ua.Gds.Server.Common.dll
Libraries\Opc.Ua.Security.Certificates\bin\Debug\netstandard2.0\Opc.Ua.Security.Certificates.dll
Libraries\Opc.Ua.Security.Certificates\bin\Debug\netstandard2.1\Opc.Ua.Security.Certificates.dll
Libraries\Opc.Ua.Security.Certificates\bin\Debug\net48\Opc.Ua.Security.Certificates.dll
Libraries\Opc.Ua.Security.Certificates\bin\Debug\net6.0\Opc.Ua.Security.Certificates.dll
Expand Down
2 changes: 2 additions & 0 deletions .azurepipelines/signlistRelease.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Stack\Opc.Ua.Core\bin\Release\netstandard2.0\Opc.Ua.Core.dll
Stack\Opc.Ua.Core\bin\Release\netstandard2.1\Opc.Ua.Core.dll
Stack\Opc.Ua.Core\bin\Release\net48\Opc.Ua.Core.dll
Stack\Opc.Ua.Core\bin\Release\net6.0\Opc.Ua.Core.dll
Expand Down Expand Up @@ -30,6 +31,7 @@ Libraries\Opc.Ua.Gds.Server.Common\bin\Release\netstandard2.1\Opc.Ua.Gds.Server.
Libraries\Opc.Ua.Gds.Server.Common\bin\Release\net48\Opc.Ua.Gds.Server.Common.dll
Libraries\Opc.Ua.Gds.Server.Common\bin\Release\net6.0\Opc.Ua.Gds.Server.Common.dll
Libraries\Opc.Ua.Gds.Server.Common\bin\Release\net8.0\Opc.Ua.Gds.Server.Common.dll
Libraries\Opc.Ua.Security.Certificates\bin\Release\netstandard2.0\Opc.Ua.Security.Certificates.dll
Libraries\Opc.Ua.Security.Certificates\bin\Release\netstandard2.1\Opc.Ua.Security.Certificates.dll
Libraries\Opc.Ua.Security.Certificates\bin\Release\net48\Opc.Ua.Security.Certificates.dll
Libraries\Opc.Ua.Security.Certificates\bin\Release\net6.0\Opc.Ua.Security.Certificates.dll
Expand Down
9 changes: 5 additions & 4 deletions .azurepipelines/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ jobs:
inputs:
targetType: filePath
filePath: ./.azurepipelines/get-matrix.ps1
arguments: -FileName azure-pipelines.yml -AgentTable ${{ parameters.agents }}
arguments: -FileName *.Tests.csproj -AgentTable ${{ parameters.agents }}
- job: testall${{ parameters.jobnamesuffix }}
displayName: Tests (${{ parameters.framework }})
dependsOn: testprep${{ parameters.jobnamesuffix }}
timeoutInMinutes: 120
strategy:
matrix: $[dependencies.testprep${{ parameters.jobnamesuffix }}.outputs['testmatrix.jobMatrix'] ]
variables:
Expand Down Expand Up @@ -62,12 +63,12 @@ jobs:
displayName: Restore ${{ parameters.configuration }}
inputs:
command: restore
projects: '**/*.Tests.csproj'
projects: $(file)
arguments: '${{ variables.DotCliCommandline }} --configuration ${{ parameters.configuration }}'
- task: DotNetCoreCLI@2
displayName: Test ${{ parameters.configuration }}
timeoutInMinutes: 60
timeoutInMinutes: 30
inputs:
command: test
projects: '**/*.Tests.csproj'
projects: $(file)
arguments: '--no-restore ${{ variables.DotCliCommandline }} --configuration ${{ parameters.configuration }}'
2 changes: 1 addition & 1 deletion .azurepipelines/testcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
inputs:
command: test
projects: 'UA Core Library.sln'
# note: /p:CollectCoverage=true is only used to disable deterministc builds
# note: /p:CollectCoverage=true is only used to disable deterministic builds
arguments: '--no-restore ${{ variables.DotCliCommandline }} --configuration ${{ parameters.configuration }} /p:CollectCoverage=true --collect:"XPlat Code Coverage" --settings ./Tests/coverlet.runsettings.xml --results-directory $(Agent.TempDirectory)'
publishTestResults: false
- script: |
Expand Down
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ dotnet_diagnostic.IDE1005.severity =
# CA1305: Specify IFormatProvider
dotnet_diagnostic.CA1305.severity = warning

# CA1819: Properties should not return arrays
dotnet_diagnostic.CA1819.severity = silent

# CA1721: The property name is confusing given the existence of another method with the same name.
dotnet_diagnostic.CA1721.severity = silent

# exclude generated code
[**/Generated/*.cs]
generated_code = true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: dotnet build ${{ env.CSPROJECT }} --force --framework ${{ matrix.framework }} --configuration ${{ matrix.configuration }} /p:CustomTestTarget=${{ matrix.customtesttarget }}

- name: Test
# note: /p:CollectCoverage=true is only used to disable deterministc builds
# note: /p:CollectCoverage=true is only used to disable deterministic builds
run: dotnet test ${{ env.CSPROJECT }} --no-build --framework ${{ matrix.framework }} --logger trx --configuration ${{ matrix.configuration }} /p:CollectCoverage=true /p:CustomTestTarget=${{ matrix.customtesttarget }} --collect:"XPlat Code Coverage" --settings ./Tests/coverlet.runsettings.xml --results-directory ${{ env.TESTRESULTS }}

- name: Upload test results
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,8 @@ OPC\ Foundation/
/SampleApplications/Samples/OPCOutput
!**/Assets/*.*
*.Nodeset2.xml.zip

# UA Fuzzing findings folders
/Fuzzing/**/findings/
/Fuzzing/**/Testcases/
!/Fuzzing/**/Testcases/*.bin
2 changes: 1 addition & 1 deletion Applications/ConsoleReferenceClient/ClientSamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ public void SubscribeToDataChanges(ISession session, uint minLifeTime)
ClientBase.ValidateResponse(browseResultCollection, browseCollection);
ClientBase.ValidateDiagnosticInfos(diagnosticsInfoCollection, browseCollection);

// seperate unprocessed nodes for later
// separate unprocessed nodes for later
int ii = 0;
foreach (BrowseResult browseResult in browseResultCollection)
{
Expand Down
19 changes: 17 additions & 2 deletions Applications/ConsoleReferenceClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ public static async Task Main(string[] args)
int timeout = Timeout.Infinite;
string logFile = null;
string reverseConnectUrlString = null;
bool leakChannels = false;
bool forever = false;

Mono.Options.OptionSet options = new Mono.Options.OptionSet {
usage,
Expand All @@ -104,6 +106,8 @@ public static async Task Main(string[] args)
{ "v|verbose", "Verbose output", v => { if (v != null) verbose = true; } },
{ "s|subscribe", "Subscribe", s => { if (s != null) subscribe = true; } },
{ "rc|reverseconnect=", "Connect using the reverse connect endpoint. (e.g. rc=opc.tcp://localhost:65300)", (string url) => reverseConnectUrlString = url},
{ "forever", "run inner connect/disconnect loop forever", f => { if (f != null) forever = true; } },
{ "leakchannels", "Leave a channel leak open when disconnecting a session.", l => { if (l != null) leakChannels = true; } },
};

ReverseConnectManager reverseConnectManager = null;
Expand Down Expand Up @@ -189,12 +193,23 @@ public static async Task Main(string[] args)
waitTime = timeout - (int)DateTime.UtcNow.Subtract(start).TotalMilliseconds;
if (waitTime <= 0)
{
if (!forever)
{
break;
}
else
{
waitTime = 0;
}
}

// create the UA Client object and connect to configured server.
if (forever)
{
start = DateTime.UtcNow;
}
}

// create the UA Client object and connect to configured server.
using (UAClient uaClient = new UAClient(application.ApplicationConfiguration, reverseConnectManager, output, ClientBase.ValidateResponse) {
AutoAccept = autoAccept,
SessionLifeTime = 60_000,
Expand Down Expand Up @@ -308,7 +323,7 @@ public static async Task Main(string[] args)

output.WriteLine("Client disconnected.");

uaClient.Disconnect();
uaClient.Disconnect(leakChannels);
}
else
{
Expand Down
13 changes: 11 additions & 2 deletions Applications/ConsoleReferenceClient/UAClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public UAClient(ApplicationConfiguration configuration, ReverseConnectManager re
/// </summary>
public void Dispose()
{
m_disposed = true;
Utils.SilentDispose(m_session);
m_configuration.CertificateValidator.CertificateValidation -= CertificateValidation;
GC.SuppressFinalize(this);
Expand Down Expand Up @@ -133,6 +134,7 @@ public void Dispose()
/// </summary>
public async Task<bool> ConnectAsync(string serverUrl, bool useSecurity = true, CancellationToken ct = default)
{
if (m_disposed) throw new ObjectDisposedException(nameof(UAClient));
if (serverUrl == null) throw new ArgumentNullException(nameof(serverUrl));

try
Expand Down Expand Up @@ -230,7 +232,8 @@ public async Task<bool> ConnectAsync(string serverUrl, bool useSecurity = true,
/// <summary>
/// Disconnects the session.
/// </summary>
public void Disconnect()
/// <param name="leaveChannelOpen">Leaves the channel open.</param>
public void Disconnect(bool leaveChannelOpen = false)
{
try
{
Expand All @@ -245,7 +248,12 @@ public void Disconnect()
m_reconnectHandler = null;
}

m_session.Close();
m_session.Close(!leaveChannelOpen);
if (leaveChannelOpen)
{
// detach the channel, so it doesn't get closed when the session is disposed.
m_session.DetachChannel();
}
m_session.Dispose();
m_session = null;

Expand Down Expand Up @@ -387,6 +395,7 @@ protected virtual void CertificateValidation(CertificateValidator sender, Certif
private ISession m_session;
private readonly TextWriter m_output;
private readonly Action<IList, IList> m_validateResponse;
private bool m_disposed = false;
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<MaxArrayLength>65535</MaxArrayLength>
<MaxMessageSize>4194304</MaxMessageSize>
<MaxBufferSize>65535</MaxBufferSize>
<ChannelLifetime>300000</ChannelLifetime>
<ChannelLifetime>30000</ChannelLifetime>
<SecurityTokenLifetime>3600000</SecurityTokenLifetime>
</TransportQuotas>
<ServerConfiguration>
Expand All @@ -124,9 +124,9 @@
-->
<!--
<AlternateBaseAddresses>
<ua:String>http://AlternateHostName/Quickstarts/ReferenceServer</ua:String>
<ua:String>http://10.10.103.150/Quickstarts/ReferenceServer</ua:String>
<ua:String>http://[2a01::626d]/Quickstarts/ReferenceServer</ua:String>
<ua:String>opc.tcp://AlternateHostName/Quickstarts/ReferenceServer</ua:String>
<ua:String>opc.tcp://10.10.103.150/Quickstarts/ReferenceServer</ua:String>
<ua:String>opc.tcp://[2a01::626d]/Quickstarts/ReferenceServer</ua:String>
</AlternateBaseAddresses>
-->
<SecurityPolicies>
Expand Down Expand Up @@ -230,6 +230,7 @@
<DiagnosticsEnabled>true</DiagnosticsEnabled>
<!-- Settings for CTT testing -->
<MaxSessionCount>75</MaxSessionCount>
<MaxChannelCount>1000</MaxChannelCount>
<MinSessionTimeout>10000</MinSessionTimeout>
<MaxSessionTimeout>3600000</MaxSessionTimeout>
<MaxBrowseContinuationPoints>10</MaxBrowseContinuationPoints>
Expand Down Expand Up @@ -296,6 +297,7 @@
<ua:String>http://opcfoundation.org/UA-Profile/Server/ReverseConnect</ua:String>
<ua:String>http://opcfoundation.org/UA-Profile/Server/ClientRedundancy</ua:String>
</ServerProfileArray>

<ShutdownDelay>5</ShutdownDelay>
<ServerCapabilities>
<ua:String>DA</ua:String>
Expand Down Expand Up @@ -326,17 +328,15 @@
<OperationLimits>
<MaxNodesPerRead>2500</MaxNodesPerRead>
<MaxNodesPerHistoryReadData>1000</MaxNodesPerHistoryReadData>
<MaxNodesPerHistoryReadEvents>1000</MaxNodesPerHistoryReadEvents>
<MaxNodesPerWrite>2500</MaxNodesPerWrite>
<MaxNodesPerHistoryUpdateData>1000</MaxNodesPerHistoryUpdateData>
<MaxNodesPerHistoryUpdateEvents>1000</MaxNodesPerHistoryUpdateEvents>
<MaxNodesPerMethodCall>2500</MaxNodesPerMethodCall>
<MaxNodesPerBrowse>2500</MaxNodesPerBrowse>
<MaxNodesPerRegisterNodes>2500</MaxNodesPerRegisterNodes>
<MaxNodesPerTranslateBrowsePathsToNodeIds>2500</MaxNodesPerTranslateBrowsePathsToNodeIds>
<MaxNodesPerNodeManagement>2500</MaxNodesPerNodeManagement>
<MaxMonitoredItemsPerCall>2500</MaxMonitoredItemsPerCall>
</OperationLimits>

<AuditingEnabled>true</AuditingEnabled>
</ServerConfiguration>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private static void UpdateDisplayName(BaseInstanceState instance, string unitLab
}

/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
namespace Boiler
{
/// <summary>
/// A object representing a generic controller.
/// An object representing a generic controller.
/// </summary>
public partial class GenericControllerState
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public override void CreateAddressSpace(IDictionary<NodeId, IList<IReference>> e
}

/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void CreateBuffer(BuiltInType elementType, int noOfElements)
}

/// <summary>
/// Creates an object which can browser the tags in the buffer.
/// Creates an object which can browse the tags in the buffer.
/// </summary>
public override INodeBrowser CreateBrowser(
ISystemContext context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public virtual void CreateAddressSpace(IDictionary<NodeId, IList<IReference>> ex

#region CreateAddressSpace Support Functions
/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
public virtual void LoadPredefinedNodes(
ISystemContext context,
Expand All @@ -381,15 +381,15 @@ public virtual void CreateAddressSpace(IDictionary<NodeId, IList<IReference>> ex
}

/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
protected virtual NodeStateCollection LoadPredefinedNodes(ISystemContext context)
{
return new NodeStateCollection();
}

/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
protected virtual void LoadPredefinedNodes(
ISystemContext context,
Expand Down Expand Up @@ -722,7 +722,7 @@ protected void AddTypesToTypeTree(NodeId typeId)
}

/// <summary>
/// Finds the specified and checks if it is of the expected type.
/// Finds the specified node and checks if it is of the expected type.
/// </summary>
/// <returns>Returns null if not found or not of the correct type.</returns>
public NodeState FindPredefinedNode(NodeId nodeId, Type expectedType)
Expand Down Expand Up @@ -1297,7 +1297,7 @@ public virtual void AddReferences(IDictionary<NodeId, IList<IReference>> referen
{
errors[ii] = StatusCodes.BadNodeIdUnknown;

// must validate node in a seperate operation.
// must validate node in a separate operation.
ReadWriteOperationState operation = new ReadWriteOperationState();

operation.Source = source;
Expand Down Expand Up @@ -1429,7 +1429,7 @@ protected virtual bool ValidateNode(ServerSystemContext context, NodeState node)
// check if the node is ready for reading.
if (source.ValidationRequired)
{
// must validate node in a seperate operation.
// must validate node in a separate operation.
errors[ii] = StatusCodes.BadNodeIdUnknown;
nodesToValidate.Add(operation);
continue;
Expand Down Expand Up @@ -1639,7 +1639,7 @@ protected virtual bool ValidateNode(ServerSystemContext context, NodeState node)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;

// must validate node in a seperate operation.
// must validate node in a separate operation.
ReadWriteOperationState operation = new ReadWriteOperationState();

operation.Source = source;
Expand Down Expand Up @@ -1734,7 +1734,7 @@ protected virtual bool ValidateNode(ServerSystemContext context, NodeState node)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;

// must validate node in a seperate operation.
// must validate node in a separate operation.
ReadWriteOperationState operation = new ReadWriteOperationState();

operation.Source = source;
Expand Down Expand Up @@ -1832,7 +1832,7 @@ protected virtual bool ValidateNode(ServerSystemContext context, NodeState node)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;

// must validate node in a seperate operation.
// must validate node in a separate operation.
CallOperationState operation = new CallOperationState();

operation.Source = source;
Expand Down Expand Up @@ -2243,7 +2243,7 @@ private struct CallOperationState
{
errors[ii] = StatusCodes.BadNodeIdUnknown;

// must validate node in a seperate operation.
// must validate node in a separate operation.
ReadWriteOperationState operation = new ReadWriteOperationState();

operation.Source = source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public override void CreateAddressSpace(IDictionary<NodeId, IList<IReference>> e
}

/// <summary>
/// Loads a node set from a file or resource and addes them to the set of predefined nodes.
/// Loads a node set from a file or resource and adds them to the set of predefined nodes.
/// </summary>
protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
{
Expand Down
Loading

0 comments on commit 7bcce20

Please sign in to comment.