Files
UA-.NETStandard/Libraries
Marc Schier d2fa85c989 Fix BadContinuationPointInvalid caused by empty continuation point in Browser.BrowseAsync (#4168)
Re-submission of #4167 against `master378`.

# Description

#4167 was merged directly into `release/1.5.378`. Maintenance fixes for
the 1.5.378 lineage have to land on `master378` first, so the commit was
removed from `release/1.5.378` again and the fix is submitted here
instead.

Servers 1.6.0 and higher return a **zero length** continuation point in
the `Browse` response to indicate that no further references are
available. `Browser.BrowseAsync` only checked the continuation point for
`null`, so it issued a `BrowseNext` call with an empty continuation
point, which the server rejects with `BadContinuationPointInvalid`.

The fix follows the continuation point only if it actually contains
data. This is consistent with the already existing
`continuationPoint?.Length > 0` check in the
`OperationCanceledException` filter of the same method.

Credit for the original fix goes to @KarenKrill (#4167).

## Related Issues

- Fixes #3698
- Supersedes #4167

## Checklist

- [x] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [x] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [x] I have added all necessary documentation.
- [x] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [x] I ran the affected tests locally.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.

## Further comments

New unit tests in `Tests/Opc.Ua.Client.Tests/BrowserUnitTests.cs` pin
the behaviour for `null`, empty and non empty continuation points.
Verified that the new tests fail without the one line change and pass
with it:

`dotnet test Tests\Opc.Ua.Client.Tests\Opc.Ua.Client.Tests.csproj -f
net10.0 --filter "FullyQualifiedName~BrowserUnitTests"` -> `Failed: 0,
Passed: 3`

The issue does not exist on `master` (2.0), where the `ByteString`
refactoring already handles this.

Co-authored-by: KarenKrill <74286712+KarenKrill@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 75db5878-10f9-4099-993a-5eb969fa080e
2026-08-03 13:38:23 +00:00
..