Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 7 additions & 2 deletions .azurepipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- job: buildprep
displayName: Prepare Build Jobs
pool:
vmImage: 'windows-2019'
vmImage: 'windows-2022'
variables:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
Expand All @@ -31,7 +31,12 @@ jobs:
- task: NuGetAuthenticate@1
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=5.8.x'
versionSpec: '>=7.0.x'
- task: UseDotNet@2
displayName: 'Install .NET 10.0'
inputs:
packageType: 'sdk'
version: '10.0.x'
- task: DotNetCoreCLI@2
displayName: Release Restore
inputs:
Expand Down
2 changes: 1 addition & 1 deletion .azurepipelines/get-matrix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if ($AgentTable -eq $null -or $AgentTable.Count -eq 0)
$agents = @{
windows = "windows-2022"
linux = "ubuntu-22.04"
mac = "macOS-13"
mac = "macOS-15"
}
}
else {
Expand Down
7 changes: 6 additions & 1 deletion .azurepipelines/sln.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ jobs:
vmImage: 'windows-2022'
steps:
- task: NuGetAuthenticate@1
- task: UseDotNet@2
displayName: 'Install .NET 10.0'
inputs:
packageType: 'sdk'
version: '10.0.x'
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=5.8.x'
versionSpec: '>=7.0.x'
- task: NuGetCommand@2
displayName: Restore Release
inputs:
Expand Down
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,9 @@ dotnet_diagnostic.CA1859.severity = silent
# CA1861: Avoid constant arrays as arguments
dotnet_diagnostic.CA1861.severity = silent

# CA1848: Use the LoggerMessage delegates
dotnet_diagnostic.CA1848.severity = suggestion

[**/Generated/*.cs]
generated_code = true
dotnet_diagnostic.severity = none
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ jobs:
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: Setup .NET
- name: Set up .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '6.x' # SDK Version to use;
dotnet-version: '10.x'

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
Expand Down
24 changes: 20 additions & 4 deletions Samples/Client.Net4/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,29 @@

using System;
using System.Windows.Forms;
using Opc.Ua.Configuration;
using Microsoft.Extensions.Logging;
using Opc.Ua.Client.Controls;
using Opc.Ua.Configuration;

namespace Opc.Ua.Sample
{
public sealed class ConsoleTelemetry : TelemetryContextBase
{
public ConsoleTelemetry()
: base(
Microsoft.Extensions.Logging.LoggerFactory.Create(builder =>
{
builder.SetMinimumLevel(LogLevel.Information);
builder.AddConsole();
})
)
{
}
}
static class Program
{
private static readonly ITelemetryContext m_telemetry = new ConsoleTelemetry();

/// <summary>
/// The main entry point for the application.
/// </summary>
Expand All @@ -46,7 +62,7 @@ static void Main()
Application.SetCompatibleTextRenderingDefault(false);

ApplicationInstance.MessageDlg = new ApplicationMessageDlg();
ApplicationInstance application = new ApplicationInstance();
ApplicationInstance application = new ApplicationInstance(m_telemetry);
application.ApplicationName = "UA Sample Client";
application.ApplicationType = ApplicationType.ClientAndServer;
application.ConfigSectionName = "Opc.Ua.SampleClient";
Expand All @@ -66,11 +82,11 @@ static void Main()
application.StartAsync(new SampleServer()).Wait();

// run the application interactively.
Application.Run(new SampleClientForm(application, null, application.ApplicationConfiguration));
Application.Run(new SampleClientForm(application, null, application.ApplicationConfiguration, m_telemetry));
}
catch (Exception e)
{
ExceptionDlg.Show(application.ApplicationName, e);
ExceptionDlg.Show(m_telemetry, application.ApplicationName, e);
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions Samples/Client.Net4/SampleClientForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2005-2019 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
Expand All @@ -11,7 +11,7 @@
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Expand Down Expand Up @@ -45,9 +45,10 @@ public SampleClientForm()
public SampleClientForm(
ApplicationInstance application,
ClientForm masterForm,
ApplicationConfiguration configuration)
ApplicationConfiguration configuration,
ITelemetryContext telemetry)
:
base(configuration.CreateMessageContext(), application, masterForm, configuration)
base(configuration.CreateMessageContext(), application, masterForm, configuration, telemetry)
{
InitializeComponent();

Expand All @@ -71,7 +72,7 @@ void CertificateValidator_CertificateValidation(CertificateValidator validator,
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Samples/Client.Net4/UA Sample Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions">
<Version>9.0.8</Version>
<Version>10.0.0</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Bindings.Https">
<Version>1.5.377.21</Version>
<Version>1.5.378.11-preview</Version>
</PackageReference>
<PackageReference Include="System.Net.Http">
<Version>4.3.4</Version>
Expand Down
3 changes: 2 additions & 1 deletion Samples/ClientControls.Net4/Browse/AttributeListCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public async Task InitializeAsync(ISession session, ExpandedNodeId nodeId, Cance
{
ItemsLV.Items.Clear();
m_session = session;
Telemetry = session?.MessageContext?.Telemetry;

if (m_session == null)
{
Expand Down Expand Up @@ -414,7 +415,7 @@ protected override async Task UpdateItemAsync(ListViewItem listItem, object item
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}
#endregion
Expand Down
3 changes: 2 additions & 1 deletion Samples/ClientControls.Net4/Browse/BrowseListCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public async Task InitializeAsync(ISession session, ExpandedNodeId nodeId, Cance
{
ItemsLV.Items.Clear();
m_session = session;
Telemetry = session?.MessageContext?.Telemetry;

if (m_session == null)
{
Expand Down Expand Up @@ -152,7 +153,7 @@ protected override async Task UpdateItemAsync(ListViewItem listItem, object item
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}
#endregion
Expand Down
17 changes: 9 additions & 8 deletions Samples/ClientControls.Net4/Browse/BrowseTreeCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public async Task InitializeAsync(
m_viewId = viewId;
m_referenceTypeId = referenceTypeId;
m_browseDirection = browseDirection;
Telemetry = m_session?.MessageContext?.Telemetry;

NodesTV.Nodes.Clear();

Expand Down Expand Up @@ -289,7 +290,7 @@ private async Task UpdateNodeAsync(TreeNode parent, ReferenceDescriptionCollecti
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}

Expand Down Expand Up @@ -322,7 +323,7 @@ protected override async void SelectNode()
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}

Expand All @@ -343,7 +344,7 @@ protected override async Task<bool> BeforeExpandAsync(TreeNode clickedNode, Canc
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
return false;
}
}
Expand Down Expand Up @@ -386,7 +387,7 @@ private async void RootBTN_ClickAsync(object sender, EventArgs e)
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}

Expand All @@ -407,7 +408,7 @@ private void BrowseDirectionCTRL_SelectedIndexChanged(object sender, EventArgs e
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}

Expand All @@ -434,7 +435,7 @@ private void SelectMI_Click(object sender, EventArgs e)
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}

Expand Down Expand Up @@ -469,7 +470,7 @@ private void SelectChildrenMI_Click(object sender, EventArgs e)
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}

Expand All @@ -490,7 +491,7 @@ private void ReferenceTypeCTRL_ReferenceSelectionChanged(object sender, Referenc
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}
#endregion
Expand Down
9 changes: 5 additions & 4 deletions Samples/ClientControls.Net4/Browse/NodeListCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public async Task InitializeAsync(ISession session, IList<NodeId> nodeIds, Cance
{
ItemsLV.Items.Clear();
m_session = session;
Telemetry = session?.MessageContext?.Telemetry;

if (m_session == null || nodeIds == null || nodeIds.Count == 0)
{
Expand Down Expand Up @@ -173,12 +174,12 @@ protected override async void SelectItems()
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}

/// <see cref="Opc.Ua.Client.Controls.BaseListCtrl.EnableMenuItems" />
protected override void EnableMenuItems(ListViewItem clickedItem)
protected override void EnableMenuItems(ListViewItem clickedItem)
{
DeleteMI.Enabled = ItemsLV.SelectedItems.Count > 0;
}
Expand Down Expand Up @@ -228,7 +229,7 @@ protected override async Task OnDragDropAsync(object sender, DragEventArgs e, Ca
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}
#endregion
Expand All @@ -253,7 +254,7 @@ private void DeleteMI_Click(object sender, EventArgs e)
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_session?.MessageContext?.Telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions Samples/ClientControls.Net4/Browse/SelectNodesDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Extensions.Logging;
using Opc.Ua.Client;

namespace Opc.Ua.Client.Controls
Expand All @@ -59,6 +60,7 @@ public SelectNodesDlg()
#endregion

#region Private Fields
private ITelemetryContext m_telemetry;
#endregion

#region Public Interface
Expand All @@ -67,6 +69,7 @@ public SelectNodesDlg()
/// </summary>
public async Task<IList<ILocalNode>> ShowDialogAsync(ISession session, NodeId rootId, IList<NodeId> nodeIds, CancellationToken ct = default)
{
m_telemetry = session?.MessageContext?.Telemetry;
await BrowseCTRL.InitializeAsync(session, rootId, null, null, BrowseDirection.Forward, ct);
await ReferencesCTRL.InitializeAsync(session, rootId, ct);
await AttributesCTRL.InitializeAsync(session, rootId, ct);
Expand All @@ -89,7 +92,7 @@ private void OkBTN_Click(object sender, EventArgs e)
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}
}

Expand All @@ -107,7 +110,7 @@ private async void BrowseCTRL_NodesSelectedAsync(object sender, BrowseTreeCtrl.N
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
GuiUtils.HandleException(m_telemetry, this.Text, MethodBase.GetCurrentMethod(), exception);
}

}
Expand Down
Loading
Loading