From 326b22a7bad91106fa31c3f178d051216c809d59 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Wed, 15 Jul 2026 03:28:04 -0400 Subject: [PATCH] fix(abcip-tests): expression-body KnownProfiles.All to fix static-init NRE KnownProfiles.All used a { get; } = [...] initialiser declared textually before the static readonly profile fields it references, so C# static-init order captured an all-null list. ForFamily() then NRE'd on p.Family, faulting AbServerFixture..ctor and blocking the whole AbCip.IntegrationTests suite. Expression-body it so it evaluates on access, after the fields are set. Live-verified against the controllogix fixture: suite goes 6F/1P/3skip -> 10 pass / 0 fail / 3 skip (skips = emulator-mode tests). Integration-sweep follow-up #1 (archreview/plans/INTEGRATION-SWEEP-STATUS.md). --- .../AbServerProfile.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests/AbServerProfile.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests/AbServerProfile.cs index 04bb1509..066bfd50 100644 --- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests/AbServerProfile.cs +++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests/AbServerProfile.cs @@ -27,7 +27,11 @@ public sealed record AbServerProfile( public static class KnownProfiles { /// Gets all known server profiles. - public static IReadOnlyList All { get; } = + /// Expression-bodied (evaluated on access) so it observes the + /// static readonly profile fields below after they are initialised; + /// a { get; } = initialiser here runs in textual order — before those + /// fields — and would capture an all-null list. + public static IReadOnlyList All => [ControlLogix, CompactLogix, Micro800, GuardLogix]; /// Gets the ControlLogix profile.