Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

Proposed changes

Enables OPC UA clients to export browsed address space nodes to NodeSet2 XML format. Previously, NodeSet export was only available server-side via NodeStateCollection.

Implementation

Core Export API (CoreClientUtils.NodeSetExport.cs)

  • ExportNodesToNodeSet2(ISystemContext, IList<INode>, Stream) - exports client nodes to NodeSet2 XML
  • Converts INode instances to NodeState representations for all node classes
  • Preserves attributes, references, and namespace mappings

Client Integration (ClientSamples.cs)

  • ExportNodesToNodeSet2(ISession, IList<INode>, string) - convenience wrapper for file export

Usage

// Browse and collect nodes
var nodes = await clientSamples.FetchAllNodesNodeCacheAsync(
    uaClient, ObjectIds.ObjectsFolder, 
    fetchTree: true, filterUATypes: true);

// Export to NodeSet2
clientSamples.ExportNodesToNodeSet2(session, nodes, "address-space.xml");

Related Issues

N/A

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Test enhancement (non-breaking change to increase test coverage)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, requires version increase of Nuget packages)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc.
  • I have signed the CLA.
  • I ran tests locally with my changes, all passed.
  • I fixed all failing tests in the CI pipelines.
  • I fixed all introduced issues with CodeQL and LGTM.
  • I have added tests that prove my fix is effective or that my feature works and increased code coverage.
  • I have added necessary documentation (if appropriate).
  • Any dependent changes have been merged and published in downstream modules.

Further comments

Leverages existing UANodeSet.Export() and NodeStateCollection.SaveAsNodeSet2() infrastructure. Exported NodeSet2 files are compatible with existing import mechanisms.

Tests cover basic export, multiple node types, and round-trip import/export validation.

Original prompt

This section details on the original issue you should resolve

<issue_title>Client based nodeset export</issue_title>
<issue_description>### Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Using the OPC.Ua.Client library is it possible to connect to a server and export the address space to nodeset file? I am aware of the NodeStateCollection class which can be used on the server but i am intrested in a client based solution.

</issue_description>

<agent_instructions>Please implement this Feature </agent_instructions>

Comments on the Issue (you are @copilot in this section)

@mregen This is currently investigated for a next release... The console client sample already contains code to browse and import a complete address space of a server. Only the the Nodeset2 export is missing.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI and others added 3 commits December 9, 2025 06:14
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Copilot AI changed the title [WIP] Add client based nodeset export feature Add client-based NodeSet2 export functionality Dec 9, 2025
Copilot AI requested a review from romanett December 9, 2025 06:34
@romanett romanett marked this pull request as ready for review December 9, 2025 09:10
@marcschier marcschier merged commit 35db94c into master Dec 9, 2025
162 of 196 checks passed
@romanett romanett deleted the copilot/add-client-nodeset-export branch December 9, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client based nodeset export

4 participants