Add MinimalClient - lightweight OPC UA console client with fluent API - #4006
Conversation
|
|
…oint, StatusCode, and LoggerFactory
…ession comment, rename disposal flag
|
@copilot use the DI container described here: https://github.com/OPCFoundation/UA-.NETStandard/blob/master/Docs/DependencyInjection.md |
…() and IManagedSessionFactory
… for DI integration
…eout configuration
…edundant config registration
…nt telemetry context pattern
…ceProviderOptions validation
…ait using for session
… using inline assignment
…ments, and fluent DI with A&C support
…Configuration, remove redundant parameter
✅ Implemented. MinimalClient now uses the DI container as described in the DependencyInjection.md documentation:
See the updated Program.cs for the pattern. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4006 +/- ##
==========================================
- Coverage 73.72% 73.48% -0.24%
==========================================
Files 1340 1345 +5
Lines 179309 179707 +398
Branches 31541 31615 +74
==========================================
- Hits 132188 132051 -137
- Misses 36385 36968 +583
+ Partials 10736 10688 -48
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds a new “MinimalClient” console application to the solution to demonstrate a lightweight OPC UA client built with DI and the managed-session fluent APIs.
Changes:
- Added
Applications/MinimalClientproject (net10.0, Native AOT) with a simple browse + read flow. - Wired the new project into
UA.slnxand added a missingMicrosoft.Extensions.DependencyInjectionpackage version. - Added README documentation for running and understanding the sample.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| UA.slnx | Adds the new MinimalClient project to the solution. |
| Directory.Packages.props | Adds a package version entry for Microsoft.Extensions.DependencyInjection. |
| Applications/MinimalClient/README.md | Documents the MinimalClient purpose, features, and usage. |
| Applications/MinimalClient/Properties/AssemblyInfo.cs | Adds assembly metadata for the new project. |
| Applications/MinimalClient/Program.cs | Implements the minimal console client (DI setup + connect + browse + read). |
| Applications/MinimalClient/MinimalClient.csproj | Defines the new net10.0 console app project with AOT enabled and references. |
# Conflicts: # UA.slnx # src/Opc.Ua.Client/Fluent/OpcUaClientApplicationConfigurationFeature.cs # src/Opc.Ua.Configuration/IOpcUaApplicationConfigurationFeature.cs # src/Opc.Ua.Configuration/IOpcUaApplicationConfigurationProvider.cs # src/Opc.Ua.Configuration/OpcUaApplicationConfigurationProvider.cs # src/Opc.Ua.Configuration/OpcUaApplicationOptions.cs # src/Opc.Ua.Server/Hosting/OpcUaServerApplicationConfigurationFeature.cs # tests/Opc.Ua.Configuration.Tests/OpcUaApplicationConfigurationProviderTests.cs
Large merge bringing in ~60 upstream commits, most notably the repository layout consolidation (OPCFoundation#4010) that moves the whole tree under src/, samples/, tests/, tools/, docs/, and fuzzing/. Also includes the repo-wide source-generated logging migration (OPCFoundation#3908/OPCFoundation#4003), Part 4 6.6 Redundancy (OPCFoundation#3918), runtime NodeSet-backed node managers (OPCFoundation#3990), MinimalClient sample (OPCFoundation#4006), and many CTT/compliance and security fixes. Conflict resolution: * UA.slnx - took upstream's new-layout solution structure and added our branch-only UaLens under the /samples/ folder (samples/Opc.Ua.Lens/Opc.Ua.Lens.csproj). Dropped the stale Applications/McpServer entry (McpServer already lives under master's /tools/ section as tools/Opc.Ua.Mcp). * .azurepipelines/preview.yml, signlist{Debug,Release}.txt - took upstream's versions wholesale (pure old->new layout path rewrites for upstream-managed files; UaLens was never sign-listed). Relocations for our branch-only files that the consolidation could not auto-move (they exist only on our side, so upstream's rename didn't touch them): * Applications/Opc.Ua.Lens/ -> samples/Opc.Ua.Lens/ (alongside the other sample apps). Updated its csproj ProjectReferences from the old Stack/ + Libraries/ paths to the new src/ layout, and dropped the obsolete <None Remove ...Docs\NugetREADME.md> line (common.props no longer ships a shared root readme; each package owns its local NugetREADME.md, which UaLens already has). * Libraries/Opc.Ua.Client/UserManagement/{IUserManagementClient, UserManagementClient,UserManagementUser}.cs -> src/Opc.Ua.Client/UserManagement/ so they compile back into the (moved) client project. Suppressed CA1873 in the UaLens csproj (with comment + TODO): upstream's source-generated-logging migration enabled this analyzer repo-wide and it flags UaLens's 146 direct ILogger.Log* call sites. Migrating UaLens logging to [LoggerMessage] partials is tracked as follow-up. UaLens build clean (0 warnings / 0 errors). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
Adds
MinimalClient, a compact console OPC UA application demonstrating the unified dependency-injection surface, secure endpoint discovery, managed sessions, fluent V2 subscriptions, and Alarms & Conditions support.Changes
ConfigureApplication(options => ...)to build and validate one sharedApplicationConfigurationfor combined client/server hosts.OpcUaClientOptionsso the existingAddClient(options => ...)callback accepts application identity, PKI, and certificate-validation settings likeAddServer(...).ConfigureApplication(...)values with client defaults in either registration order; shared values take precedence and client values fill gaps.AddServer(...)configuration pattern.MinimalClientas a .NET 10 Native AOT console application using top-level statements andHostApplicationBuilder.SignAndEncrypt/Basic256Sha256endpoint by default;--insecureand--auto-acceptare explicit opt-ins with warnings.AddSubscription(...),TryAddMonitoredItem(...), andAlarmClientFactoryusage.Example
Related Issues
If there is no issue yet, open one and link it here.
Checklist
UA.slnxsolution against at least .NET Framework and .NET 10.