Files
UA-.NETStandard/tests
romanett 2a4da11a9f Fix SourceGeneration tests to probe actual Opc.Ua.Server TFM output folder (#4293)
# Description

`ModelDependencyScannerTests.GetStackReferences()` reconstructed the
`Opc.Ua.Server` output path from the **test assembly's own TFM**
(`bin/Release/net8.0`). On the netstandard2.1 nightly leg the tests run
as `net8.0` while `Opc.Ua.Server` is built as `netstandard2.1`, so the
hardcoded `net8.0` folder does not exist and every stack-compilation
test threw `System.IO.DirectoryNotFoundException`. Because this only
happens on a nightly-only leg, it was not caught by per-commit CI and
remained on `master`.

The fix stops assuming the test's TFM. A new
`ResolveServerOutputFolder()` helper probes
`src/Opc.Ua.Server/bin/<config>` for whichever TFM subfolder actually
exists, preferring an exact match to the test TFM, then falling back to
`netstandard2.1`, `netstandard2.0`, or any subfolder containing
`Opc.Ua.Server.dll`. It also throws a clear, actionable message when the
server has not been built yet.

This is test-only; no product code changes. Build passes with 0 warnings
and the previously failing tests pass locally.

## Related Issues

- Fixes #4283

## Checklist

_Put an `x` in the boxes that apply. You can complete these step by step
after opening the PR._

- [ ] 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.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-20 14:42:20 +00:00
..