Commit Graph
913 Commits
Author SHA1 Message Date
romanett 6765151a00 Fix EndpointIncomingRequest to do serviceLookup at invocation time instead of construction. This makes the object smaller and fixes a bug where the transport channel response was not sent due to unhandled exception (#3505) 2026-01-27 07:42:01 +01:00
Copilotandmarcschier 9f335c39d8 Change DebugCheck conditional compilation from DEBUG to CHECKED (#3496)
* Initial plan

* Change [Conditional("DEBUG")] to [Conditional("CHECKED")] in DebugCheck methods

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
2026-01-24 05:42:59 +01:00
e314cf53f7 Fix SourceTimestamp for variables without explicit timestamps in BaseVariableState (#3451)
* Initial plan

* Add OnReadValue callback to update timestamps on variable reads

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Add test to verify timestamp updates on variable reads

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* fix timestamp for scalar values

set loglevel in session publish when no subscriptions

ignore more keepalive errors in Client Fixture

* Fix timestamp updates for all variables (scalars and arrays)

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* create a proper fix

* Add Order parameter to test to check the timestamp before an explicit write was done

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Co-authored-by: Roman Ettlinger <romanett98@gmail.com>
2026-01-19 15:18:28 +01:00
288f02f20a Allow status code variant creation from uint (#3472)
* Allow status code variant creation from uint

* Initial plan

* Add comprehensive tests for StatusCode variant creation from uint

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

* Remove redundant assertions in StatusCode variant tests

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
2026-01-14 06:12:00 +01:00
romanett f7c3c4e18f Fix Server/ServerStatus/State SourceTimestamp. Fix Reference Server config, not loading OperationLimits due to wrong order. (#3454)
* fix ServerSourceTimestamp

* fix OperationLimits not being set for ReferenceServer
2026-01-12 13:09:15 +01:00
wxmayifei 6ab1bf7a5d fix format string (#3441) 2026-01-08 21:16:37 +09:00
romanett 5c80f9bc5a [Client & Server] Remove all usages of SoftwareCertificates (#3443)
* remove all usages of SoftwareCertificates
- Client
- Server

As per spec they are not relevant for security.
If an SDK User wants to use the SoftwareCertificates ActivateSession can be overriden

* remove from SessionClientBatchTests
2026-01-08 21:12:07 +09:00
Suciu Mircea AdrianandRoman Ettlinger d7da70b81e Refactor ApplicationConfiguration serialization for deprecated/modern settings and add tests for configuration behavior (#3415)
* Refactor ApplicationConfiguration serialization for deprecated settings and add tests for configuration behavior

* Update ApplicationConfiguration to prefer modern elements in "hybrid" configurations and add corresponding tests

* Fix GDS Tests on netstandard2.1 custom test target

* Add Test reading file containing ApplicationCertificate and ApplicationCertificates ensuring it is not marked legacy.

* Add legacy config test with only one ApplicationCertificate

---------

Co-authored-by: Roman Ettlinger <romanett98@gmail.com>
2025-12-17 14:08:08 +02:00
opcfoundation-organdRandy Armstrong 75f2a6ac6a Add OPCUA_EXCLUDE_AccessLevelExType to Opc.Ua.Core.csproj (#3421)
Co-authored-by: Randy Armstrong <randy@sparhawksoftware.com>
2025-12-17 01:19:09 -08:00
7c684f4f87 Fix client returning BadUserAccessDenied when SecurityPolicy or SecurityMode not matching (#3270)
* Initial plan

* Fix BadUserAccessDenied when SecurityPolicy/SecurityMode not matching

Modified MatchEndpoints method to throw appropriate exceptions:
- BadSecurityPolicyRejected when requested policy is not supported
- BadSecurityModeRejected when requested mode is not supported
- Maintains backward compatibility when no specific security settings requested

Added comprehensive tests to verify the fix.

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Improve code readability with extracted boolean variables

Applied code review feedback to extract parameter validation checks
into separate boolean variables for better readability.

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Add integration test for unsupported security policy

Added ConnectWithUnsupportedSecurityPolicyAsync test that:
- Uses ClientFixture to connect to test server
- Requests a security policy not supported by server
- Verifies BadSecurityPolicyRejected is thrown instead of BadUserAccessDenied
- Tests run successfully on net8.0 and net9.0 targets

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Add policy that will never work

* ignore faulty test

* update

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Co-authored-by: Roman Ettlinger <romanett98@gmail.com>
2025-12-12 11:50:25 +02:00
romanett 1e6a043597 Fix MinNonceLength for SecurityPolicies.Basic128Rsa15 (#3410) 2025-12-12 10:38:50 +02:00
ae03267fbd Add optional parent-child linking when importing NodeSet2.xml (#3396)
* Initial plan

* Fix parent-child references when importing NodeSet2.xml

- Added LinkParentChildRelationships method to establish parent-child links after import
- Sets Parent property and adds child to parent's children collection
- Added test to verify parent-child references work correctly after import
- All existing tests continue to pass

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Make parent-child linking optional with default false

- Added linkParentChild parameter to Import method (defaults to false)
- Maintains backward compatibility by not establishing parent-child relationships by default
- Added test to verify backward compatibility (default behavior)
- Updated ParentChildReferencesTest to explicitly enable the feature
- All 7 tests pass

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
2025-12-09 21:24:41 +01:00
Copilotandromanett dc85d522a6 Add support for private encodeable factory in server initialization (#3366)
* Initial plan

* Add support for private encodeable factory in server initialization

- Add new ServiceMessageContext constructor that accepts a custom IEncodeableFactory
- Add CreateMessageContext(IEncodeableFactory) overload to ApplicationConfiguration
- Mark CreateMessageContext(bool) as obsolete since the clonedFactory parameter was never used
- Add PrivateEncodeableFactory property to ServerBase for specifying a private factory
- Update all internal calls to use the new parameterless CreateMessageContext()

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Add unit tests for ServiceMessageContext private factory support

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Improve documentation for ServiceMessageContext constructors

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
2025-12-05 14:20:50 +01:00
Copilotandromanett 7cd5ae34ec Fix ExtractValueFromVariant method call condition (#3382)
* Initial plan

* Changes before error encountered

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Fix ExtractValueFromVariant condition and add comprehensive tests

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
2025-12-05 08:32:47 +01:00
74c3cb08d4 Fix: State helper methods now update timestamps and clear change masks (#3371)
* Initial plan

* Fix: Add timestamp updates and ClearChangeMasks calls to State helper methods

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Add tests for State helper method timestamp and change mask updates

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Improve test reliability by removing Thread.Sleep

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Resolve merge conflict with master by incorporating EvaluateRetainStateOnEnable method

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

* rename for merge

* merge update

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
Co-authored-by: Roman Ettlinger <romanett98@gmail.com>
2025-12-05 06:35:11 +01:00
Copilotandromanett 3f660af97d Fix BaseVariableState to return correct BuiltInType for Byte arrays vs ByteString (#3384)
* Initial plan

* Fix ByteString vs Byte array distinction in WrappedValue

Modified BaseVariableState.WrappedValue to use DataType and ValueRank
when creating Variant to correctly distinguish between byte[] (Byte array)
and ByteString. Added tests to verify the fix.

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Address code review feedback

- Remove redundant null check for NodeId (NodeId.IsNull handles null)
- Update comment in test to be more specific about ByteString testing

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
2025-12-04 20:13:01 +01:00
Marc Schier 2960388560 Update headers and license files (#3388)
Update license headers to copy right year 2025, replace RCL/GPL headers with MIT, replace the nuget license with MIT (via license expression).
2025-12-04 19:44:40 +01:00
Copilotandromanett b8ed3cc782 Fix BaseEventState.MemberwiseClone() to pass Parent to Activator.CreateInstance (#3361)
* Fix BaseEventState.MemberwiseClone() to pass Parent to Activator.CreateInstance

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
2025-12-04 15:34:51 +01:00
Copilotandromanett 30f4fa26ab Include failed value in XmlDecoder error messages (#3374)
* Initial plan

* Add enhanced error messages for XML decoding failures

- Updated CreateBadDecodingError to optionally include failed value
- Modified SafeXmlConvert to pass XML value to error handler
- Updated ReadFloat, ReadDouble, ReadDateTime, ReadGuid, ReadNodeId, ReadExpandedNodeId, and ReadEnumerated to include values in error messages
- Added comprehensive tests to validate enhanced error messages

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Fix parameter order consistency in SafeXmlConvert

Use named parameter for value argument to maintain consistency with other calls

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Use named parameters consistently in SafeXmlConvert

Use named parameters for both functionName and value for better code clarity

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
2025-12-04 15:33:40 +01:00
Rico Suter 0e8273e729 performance: Reduce allocations (logger factory reuse, check enabled) (#3387)
* Performance: Reduce memory allocations (logging, etc.)
2025-12-04 15:30:28 +01:00
Copilotandromanett 064c1516e2 Remove hardcoded Retain=true in ConditionState.UpdateStateAfterEnable (#3370)
* Initial plan

* Add EvaluateRetainStateOnEnable virtual method for ConditionState

- Removed hardcoded `Retain.Value = true` in UpdateStateAfterEnable
- Added virtual EvaluateRetainStateOnEnable method that derived classes can override
- Default implementation calls UpdateRetainState() which uses GetRetainState()
- This allows concrete classes to customize Retain evaluation when enabling conditions
- Added comprehensive tests for the new functionality
- All existing tests pass (7846 tests)

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
2025-12-03 19:42:15 +01:00
romanett 4459e70d98 [Server] Make EndpointIncomingRequest a ReadonlyStruct & pool ValueTaks (#3363)
* Make EndpointIncomingRequest a readonly struct
* Switch to ValueTask & pool ValueTasks using ValueTaskSource
2025-12-02 09:57:28 +01:00
Copilotandmarcschier f31d37ba52 Fix GetDataTypeId to return specific DataTypeId for IEncodeable types (#3353)
Modified TypeInfo.GetDataTypeId(Type) to check if IEncodeable types have a specific TypeId and return it instead of the generic Structure (i=22) DataTypeId. Added comprehensive tests for EUInformation and other well-known IEncodeable types.

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

* Simplify GetDataTypeId fix based on code review feedback

Removed unnecessary static property check and simplified the instance creation logic. Caught specific exceptions (MissingMethodException, TargetInvocationException) instead of using bare catch.

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

* Add additional exception handling for GetDataTypeId

Added handling for MethodAccessException and NotSupportedException to provide more comprehensive error handling when creating instances via Activator.CreateInstance.

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
2025-12-01 07:43:20 +01:00
Suciu Mircea Adrian 03d5d691e5 Normalize distinguished name field abbreviations for platform compatibility of attribute State/ProvinceName (#3358)
* Normalize distinguished name field abbreviations for platform compatibility of attribute State/ProvinceName

* Fix warning ca1845

* netstandard2.1 doesn’t support string.Concat with spans.
2025-11-27 09:38:11 +02:00
romanett e63a7ccaff [Server] Make SubscriptionManagement Methods Async & Fix Publishing of GoodSubscriptionTransferred Message (#3350) 2025-11-21 16:15:56 +01:00
opcfoundation-organdRandy Armstrong a2e3fc8157 Update Generated Files with latest 1.5.6. (#3344)
Co-authored-by: Randy Armstrong <randy@sparhawksoftware.com>
2025-11-16 14:56:12 +01:00
romanett 0e4b4619c8 Obsolete Sync Certificate Validator Methods (#3338)
* Obsolete Sync Certificate Validator Methods

* Update Tests

* Use HttpClientHandler directly instead of relying on reflection
2025-11-15 07:04:58 +01:00
romanett e58b759488 [Server] Pass SecureChannelContext explicitly (#3340)
* Pass SecureChannelContext explicitly in the Server Library
2025-11-14 12:00:19 +01:00
romanett 0d78fbf6f6 [Server] Obsolete APM & Sync Methods (#3334)
* Add new Generated files with NET_STANDARD_OBSOLETE_SYNC_SERVER
* Obsolete ProcessRequestAsyncResult
* Activate NET_STANDARD_OBSOLETE_SYNC_SERVER & remove StandardServerSync Methods
* Remove sync calls
2025-11-13 10:46:21 +01:00
Marc Schier 35db52a7a6 Move from .net 9 to .net 10 SDK and build new target framework .net 10 (#3333) 2025-11-13 10:45:47 +01:00
romanettandMarc Schier d25caffb03 [Server] ActivateSessionAsync / CreateSessionAsync / FindServersAsync / GetEndpointsAsync / CloseSessionAsync (#3225)
Co-authored-by: Marc Schier <marcschier@users.noreply.github.com>
2025-11-11 21:06:17 +01:00
Marc Schier 8b2f5299b1 Fix strong name signing and IVT (#3331)
* Fix IVT with sn signing and clean up unused constants.
* Update signlists
2025-11-11 13:29:37 +01:00
Marc Schier 712e770fbe Restructure core and built in types into base assembly and nuget (#3326)
This change adds a **new Opc.Ua.Types** nuget that contains core types that do not rely on generated code.  Why the name?  Because almost all code that was in the Types subfolder is part of it, and because we do not want to change the name of the Opc.Ua.Core nuget/assembly because code relies on it.  Any other name like base or bootstrap felt out of place due to the current structure already defining the name "types".  Key design is to depend on only a small set of libraries with limited transitive dependencies, that includes hashcode, logging.abstraction, and for non standard20 builds System.Text.Json (needed for localizedText mul parsing).  Also, key is to support .netstd 2.0 to support source generators and to allow removal of EEC_SUPPORT defines by removing std2.0 from core and all libraries.

The changes are mostly restructuring, and thus small but contain some key changes:

- **Status code** struct now comes with a Symbol field, which is used to carry symbols in case the code is not generated.  Currently (until generated) the status code struct must be manually created with a symbol or the ToSymbolicId extension must be called in the core project.  Future will generate Status code constants just like NodeId that contain the symbol which also removes the reflection-based lookup.  Several tests needed to be adjusted as they checked the status code symbol strings instead of the code.
- **Core identifiers** are copied as they were needed for code to compile, that includes attributes, a subset of status codes and node identifiers.  These will never change so no need to generate them.
- The types folder now contains **encoders**, except for json which is still in core.  Once the json encoder is ported to system.text.json it will also be included and Newtonsoft.Json dropped as dependency (-> #3329).  
- Since types relies on **IOperationContext** and **ISystemContext**, and these export IUserIdentity which relies on crypto, these were split and extended in core with ISessionOperationContext and ISessionSystemContext, which mean changes to ServerSystemContext and introduction of SessionOperationContext and SessionSystemContext classes that extend OperationContext and SystemContext.  Some runtime checks in the server are therefore needed to get at the session and auth info, however, those are anyway optional fields and are not on the critical paths, and thus a type check is in order (and was done in the past already, but against OperationContext class).
- **Manifest resources** are now split between Core (nodeset zip, some generated resoures) and Types (built in bsd/xsds).  This needs to be revisited later if the bsd/xsd need to be regenerated during type generation.  Note that the embedded resource names changed as a result. Since these are only used internally and do not constitute public API this feels reasonable vs duplication of resources in 2 assemblies.
- Reflection however now needs to load not just the built in **encodeables** from Opc.Ua.Types assembly, but also the generated encodeables from Opc.Ua.Core assembly.  For this a new helper Utils method was added to get the Core assembly when linked against Opc.Ua.Core otherwise null.
- Whatever utils methods needed to be split out into the new Opc.Ua.Types assembly, they are now in **CoreUtils** static class in Opc.Ua.Types, and Utils.xxxx forwards to them to ensure minimal changes.  Later we would want to obsolete them in favor of CoreUtils, although it might make sense to split them again into domain specific utilities, such as networking, files, etc
2025-11-10 19:33:24 +01:00
Marc Schier e980d825fa Use connect async instead of BeginConnect (#3321)
* Use Connect async in channels
* Add more logging to debug connectivity issues
2025-11-10 15:44:05 +01:00
opcfoundation-organdRandy Armstrong e03883abe8 Fix JsonDecoder for Unions. (#3323)
Co-authored-by: Randy Armstrong <randy@sparhawksoftware.com>
2025-11-07 13:21:59 +01:00
Marc Schier dad5dc6a87 Pull ActivityTraceFlags into IClientBase (#3319)
* Pull ActivityTraceFlags into IClientBase
* Update node parsing
* Ensure no 0 request id and revert unique request id
2025-11-05 16:51:02 +01:00
Marc Schier b5044212f0 Allow sending while connecting in client channel. (#3315)
- Remove ConnectAsync from lock. Useable means m_channel is set, not useable means it is null.
- Add comments on lock behavior during connection.
- Remove callback log from validator
- Change TCS creation to specify run continuations async
- Fix encoder factory reflecting every time it is created.
2025-11-05 15:37:36 +01:00
Marc Schier bad6bf416b Trace and metrics for send/receive, more test coverage and additional nullable annotations (#3314)
Refactored client-side logic to support batching of service requests, ensuring compliance with operation limits and improving scalability. Added telemetry and activity tracing using `ActivityTraceFlags` for better observability, including metrics collection and logging. Enhanced error handling with descriptive exception messages and improved certificate validation.

Introduced a comprehensive suite of unit tests for `SessionClientBatchTests.cs` and `ClientBaseTests.cs`, covering batching, error scenarios, and edge cases. Added helper classes for testing logging, metrics, and activity tracing. Updated tests to align with modern C# practices, including nullable reference types and collection initializers.

Improved code consistency, readability, and maintainability by standardizing method signatures, simplifying redundant patterns, and removing legacy constructs. Updated XML documentation and added conditional compilation for .NET 8.0+ compatibility.
2025-11-05 11:16:28 +01:00
romanett b422ed18a7 Configure Thread Pool for better Server Performance (#3310) 2025-11-02 14:17:48 +01:00
Marc Schier 1c178402ad Refactor client state persistence and add more tests (#3303)
* State handling and better serialization
* Nullable for almost everything  inclient library
* Additional testing of session
2025-11-01 17:18:48 +01:00
Copilotandmarcschier 7626d82aa1 Add TryParse methods to NodeId and ExpandedNodeId (#3302)
* Initial plan

* Add TryParse methods to NodeId and ExpandedNodeId with comprehensive tests

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

* Address code review feedback: use explicit Exception catch and improve consistency

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

* Refactor TryParse to be core implementation, Parse now calls TryParse

Changed architecture so TryParse contains the parsing logic without throwing exceptions.
Parse methods now call TryParse and throw appropriate exceptions on failure.
This avoids using try-catch for control flow as requested.

All 1643 BuiltInType tests pass.

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

* Refactor ExpandedNodeId InternalTryParse to avoid creating object in try-catch

Reworked the static InternalTryParse method to directly parse ExpandedNodeId
components without creating an ExpandedNodeId object and catching exceptions.

Also refactored the instance InternalParse method to use a new InternalTryParseInstance
helper that implements TryParse pattern, with InternalParse calling it and throwing
appropriate exceptions (ArgumentException or ServiceResultException) on failure.

All 1643 BuiltInType tests pass.

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
2025-11-01 09:36:21 +01:00
Suciu Mircea Adrian 1f47847324 Added RejectCertificateUriMismatch property and explicit ApplicationUri validation after certificates are loaded (#3244)
* Added RejectCertificateUriMismatch property and explicit ApplicationUri validation after certificates are loaded

* Perform duplicate detection on thumbprint only

* Ported handle multiple ApplictionUri, removed assign ApplictionUri from certificate

* Missing letter

* Fixed LoadPrivateKeyAsync when no applicationUri is passed.

* Add tests for validating certificates with multiple AplicationUris on ApplicationInstance level and server side

* Renamed into CheckOrCreateCertificateAsync, logged Certificate, improved tests

* Added retry logic for transient connect errors in CreateSessionApplicationUriValidationTests

* Added TODO log when telemetry instance available

* Removed unused ValidateServerCertificateApplicationUri(X509Certificate2 serverCertificate)
2025-10-31 14:17:31 +01:00
8d2286305a 1.05.06 generated files (#3299)
* Update to 1.05.06 generated files.

* Update generated files to 1.05.06.

* fix GDS build

---------

Co-authored-by: Randy Armstrong <randy@sparhawksoftware.com>
Co-authored-by: Roman Ettlinger <romanett98@gmail.com>
2025-10-30 15:33:42 +01:00
romanett 820f6a293c [Server] Refactor Publishing to work with TAP (#3289) 2025-10-30 05:36:54 +01:00
fab6f2ac1a [Client] Obsolete APM calls (#3282)
* Refactor for robustness and async improvements

Refactored code to enhance robustness and maintainability by enabling nullable reference types and using `async`/`await` for asynchronous operations. Updated exception handling to use `BadNotConnected()` for more accurate error states. Removed unused code and improved test files to align with these changes. Introduced `OpenInternalAsync` for better channel management and handled on-demand connection creation in `SendRequestAsync`.

* Obsolete APM
* Remove WCF remainders, channel clean up and initial cut at Channel factory
* Clean up copyright notice formatting
* Make connect async in Socket and abstract bindings for easier testing
* Fix unit tests

These changes enhance robustness, maintainability, and correctness of channel and task management.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Roman Ettlinger <romanett98@gmail.com>
2025-10-24 13:37:59 +02:00
Copilotandmarcschier 62b3ada536 Fix NodeId.Parse() to reject invalid identifiers without type prefix (#3284)
* Fix NodeId.Parse() to reject invalid identifiers without proper prefix

- Modified NodeId.InternalParse() to distinguish between namespace URI (from ExpandedNodeId) and namespace index (from ns=)
- Only allow implicit string identifiers when namespace URI is specified (nsu=), not when namespace index is specified (ns=)
- Added test case NodeIdParseInvalidWithNamespace to verify invalid NodeIds are rejected
- Fixed existing tests that were relying on the buggy behavior

Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
2025-10-24 11:14:11 +02:00
Marc Schier f8042e445c Check bounds for switched on values and roslyn cleanup (#3264) 2025-10-21 09:28:19 +02:00
8152feec71 Allow non OPC-UA conform SubjectName values to AddSecurityConfigurationStores (#3229)
* Replace fuzzy search with SimpleName search if comparing DistinguishedName fails.

* Added mandatory Organization Name attribute to SetSuitableDefaults().
Added Test for the special case.

* Added missing O attribute to CompareDistinguishedName call

* Update test

* CertificateIdentifier.Find will pick the certificate with the longest duration

* Find only valid certificates.

* Prioritizes CA-signed certificates over self-signed certificates

* Update Tests/Opc.Ua.Configuration.Tests/ApplicationInstanceTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Select longest remaining validity if valid, or least expired if all expired

* Renamings

* Improved comments, improved algo clarity and taken into account more possible cases of prioritization depending on cert validity

* Comment corrected

---------

Co-authored-by: romanett <romanett98@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-21 09:26:29 +03:00
Marc Schier ff0095c93d Make GDS tests stable and add better logging to unit tests (#3271)
- Allow setting ReturnDiagnostics on the session factory to ensure the diagnostic settings are part of "Create" also.  Set them to SymbolicIdAndText by default.
- Better logging in unit tests, now also logs to progress including exception traces, also prefixes SERVER and TEST on console to attach the logs to the server or client side.
- GDS client stability improvements to ensure client reliably reconnects between calls when connection is lost.
- Do not dispose the application certificate when it is updated from GDS client to avoid existing sessions to crash with CryptographicException.  This needs more improvements later on because it is rather hacky today.
- Remove the certificate cache in CertificateFactory (as per discussion and agreement) which allowed re-enabling the older UserIdentity API
- Logging improvements here and there to analyze issues in unit tests better
2025-10-20 18:02:45 +02:00
Marc SchierandCopilot ca43b642b6 Fix WriteArray in encoders to also write null. (#3266)
* Add test to test encoding "Null" array and expect empty array or null to be decoded.
* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-16 08:24:20 +02:00