Skip to content

fix(repo): restore multi-TFM compatibility for Release pack - #218

Open
ottobolyos wants to merge 2 commits into
TrakHound:masterfrom
ottobolyos:fix/multi-tfm-compat
Open

fix(repo): restore multi-TFM compatibility for Release pack#218
ottobolyos wants to merge 2 commits into
TrakHound:masterfrom
ottobolyos:fix/multi-tfm-compat

Conversation

@ottobolyos

@ottobolyos ottobolyos commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Restores Release-configuration pack-ability across the full TFM matrix. Scoped to one multi-TFM fix + its RED pinning test — 2 commits, net461net9.0 clean.

Behavior change

None at runtime — pure compile-time fix on non-net8.0 TFMs.

  • SupportedOSPlatformAttribute compat. The attribute lives in System.Runtime.Versioning on .NET 5.0+ but is absent on net4x and netstandard2.0. Six Windows-only Service / HTTP-server types decorated by dd2eb424 (2026-05-22) failed CS0122 / CS0246 in the Release-pack matrix. This PR wraps each site in #if NET5_0_OR_GREATER. CI runs only Debug / net8.0 and never exercises Release multi-TFM, which is how the regression slipped through.

The matrix-spanning CI gate ships in PR #219 (already merged as 7626218).

Files touched

  • adapter/MTConnect.NET-Applications-Adapter/Service.cs
  • agent/MTConnect.NET-Applications-Agents/Service.cs
  • libraries/MTConnect.NET-Services/MTConnectAdapterService.cs
  • libraries/MTConnect.NET-Services/MTConnectAgentService.cs
  • libraries/MTConnect.NET-Services/WindowsService.cs
  • tests/MTConnect.NET-Common-Tests/MTConnect.NET-Common-Tests.csproj
  • tests/MTConnect.NET-Common-Tests/Platform/SupportedOSPlatformAttributePresenceTests.cs

Dime review cycle 1

Retroactive backfill (2026-08-20). The 6-agent dime review cycle (code-review, security-audit, simplification, improvement, documentation-audit, test-coverage-audit) was recorded as completed on this PR against head 1229132d before the ledger section was standardized. Ledger reconstruction from commit history + PR comments:

Rebase-shrink pass (2026-08-21)

Head-priority audit against master + against the current XsdPreprocessor source: the LangVersion 8.0 bump (2be0e055) was based on a stale premise — master's XsdPreprocessor.StripXsd11Constructs at line 62 uses the older C# 7.3-compatible using (var reader = new StringReader(...)) block form, not the C# 8.0 using var reader = ... declaration form. No LangVersion bump is required. The paired test(xml): pin using-declarations code path (7e3f721c) falls with the same premise.

Rebase-interleaved to the minimum-scope 2-commit shape:

  1. test(common): pin SupportedOSPlatform attribute on Service types (RED) — reflection-based pin over the six wrapped sites.
  2. fix(common): wrap SupportedOSPlatform in NET5_0_OR_GREATER for multi-TFM — the GREEN wrap.

tests/MTConnect.NET-XML-Tests/Xml/UsingDeclarationsTests.cs and libraries/MTConnect.NET-XML/MTConnect.NET-XML.csproj are dropped along with the 2 spurious commits. Commit-body BrE (analyser × 2) rewritten to American English analyzer at the same time.

Depends on

@ottobolyos ottobolyos changed the title fix(build): restore multi-TFM compatibility for Release pack fix(repo): restore multi-TFM compatibility for Release pack Aug 17, 2026
ottobolyos pushed a commit to ottobolyos/mtconnect.net that referenced this pull request Aug 18, 2026
…tract

Three doc surfaces went stale when PR TrakHound#218 split observation/asset validation off from
Device-tree validation and added the empty-Result coerce. Refresh each so a reader
following the docs learns the actual runtime behaviour.

- docs/concepts/agent-validation-events.md: split the validation decision by element
  kind. The mermaid flowchart now branches on Device-tree vs Observation/Asset before
  routing into DeviceValidationLevel or InputValidationLevel; the "Wire-up",
  "Contributor POV — Wiring a new entry", and "See also" sections now name the correct
  enum per family; the "What happens to the rejected input" section splits into two
  bullet lists so callers reach for the right knob. Adds a short paragraph on the
  load-time migration bridge so upgraders who only set inputValidationLevel keep the
  Device-tree behaviour they had before v7.

- docs/cli/agent.md: adds the deviceValidationLevel row to the top-level-keys table,
  documenting the enum arms, the mirror-from-inputValidationLevel default, and the
  per-arm agent behaviour (Ignore accepts everything; Warning raises the matching
  Invalid*Added event; Remove prunes the offending node from the Device tree; Strict
  rejects the entire Device).

- docs/wire-formats/shdr.md: adds a paragraph to the "Line shape" section documenting
  that a key with no value segment emits an UNAVAILABLE Result rather than being
  silently dropped, and that the same coerce catches the shape for third-party
  ingress paths that reach AddObservation with an empty-string Result. Notes the
  DATA_SET / TABLE / TIME_SERIES / CONDITION exemptions.
ottobolyos pushed a commit to ottobolyos/mtconnect.net that referenced this pull request Aug 19, 2026
…tract

Three doc surfaces went stale when PR TrakHound#218 split observation/asset validation off from
Device-tree validation and added the empty-Result coerce. Refresh each so a reader
following the docs learns the actual runtime behavior.

- docs/concepts/agent-validation-events.md: split the validation decision by element
  kind. The mermaid flowchart now branches on Device-tree vs Observation/Asset before
  routing into DeviceValidationLevel or InputValidationLevel; the "Wire-up",
  "Contributor POV — Wiring a new entry", and "See also" sections now name the correct
  enum per family; the "What happens to the rejected input" section splits into two
  bullet lists so callers reach for the right knob. Adds a short paragraph on the
  load-time migration bridge so upgraders who only set inputValidationLevel keep the
  Device-tree behavior they had before v7.

- docs/cli/agent.md: adds the deviceValidationLevel row to the top-level-keys table,
  documenting the enum arms, the mirror-from-inputValidationLevel default, and the
  per-arm agent behavior (Ignore accepts everything; Warning raises the matching
  Invalid*Added event; Remove prunes the offending node from the Device tree; Strict
  rejects the entire Device).

- docs/wire-formats/shdr.md: adds a paragraph to the "Line shape" section documenting
  that a key with no value segment emits an UNAVAILABLE Result rather than being
  silently dropped, and that the same coerce catches the shape for third-party
  ingress paths that reach AddObservation with an empty-string Result. Notes the
  DATA_SET / TABLE / TIME_SERIES / CONDITION exemptions.
@ottobolyos
ottobolyos force-pushed the fix/multi-tfm-compat branch from b71e95c to b587848 Compare August 19, 2026 12:12
ottobolyos added a commit to ottobolyos/mtconnect.net that referenced this pull request Aug 19, 2026
ottobolyos pushed a commit to ottobolyos/mtconnect.net that referenced this pull request Aug 19, 2026
…tract

Three doc surfaces went stale when PR TrakHound#218 split observation/asset validation off from
Device-tree validation and added the empty-Result coerce. Refresh each so a reader
following the docs learns the actual runtime behavior.

- docs/concepts/agent-validation-events.md: split the validation decision by element
  kind. The mermaid flowchart now branches on Device-tree vs Observation/Asset before
  routing into DeviceValidationLevel or InputValidationLevel; the "Wire-up",
  "Contributor POV — Wiring a new entry", and "See also" sections now name the correct
  enum per family; the "What happens to the rejected input" section splits into two
  bullet lists so callers reach for the right knob. Adds a short paragraph on the
  load-time migration bridge so upgraders who only set inputValidationLevel keep the
  Device-tree behavior they had before v7.

- docs/cli/agent.md: adds the deviceValidationLevel row to the top-level-keys table,
  documenting the enum arms, the mirror-from-inputValidationLevel default, and the
  per-arm agent behavior (Ignore accepts everything; Warning raises the matching
  Invalid*Added event; Remove prunes the offending node from the Device tree; Strict
  rejects the entire Device).

- docs/wire-formats/shdr.md: adds a paragraph to the "Line shape" section documenting
  that a key with no value segment emits an UNAVAILABLE Result rather than being
  silently dropped, and that the same coerce catches the shape for third-party
  ingress paths that reach AddObservation with an empty-string Result. Notes the
  DATA_SET / TABLE / TIME_SERIES / CONDITION exemptions.
@ottobolyos
ottobolyos force-pushed the fix/multi-tfm-compat branch from b587848 to 1cf02a1 Compare August 19, 2026 22:05
ottobolyos added a commit to ottobolyos/mtconnect.net that referenced this pull request Aug 19, 2026
@ottobolyos
ottobolyos force-pushed the fix/multi-tfm-compat branch from 1cf02a1 to 1229132 Compare August 20, 2026 12:20
@ottobolyos
ottobolyos force-pushed the fix/multi-tfm-compat branch 3 times, most recently from 0d6b1a4 to 09502e3 Compare August 21, 2026 12:03
ottobolyos added a commit to ottobolyos/mtconnect.net that referenced this pull request Aug 21, 2026
@ottobolyos
ottobolyos force-pushed the fix/multi-tfm-compat branch from 09502e3 to ef9ea58 Compare August 21, 2026 12:09
ottobolyos added a commit to ottobolyos/mtconnect.net that referenced this pull request Aug 21, 2026
ottobolyos added a commit to ottobolyos/mtconnect.net that referenced this pull request Aug 21, 2026
Adds a reflection-based fixture under
tests/MTConnect.NET-Common-Tests/Platform/ that asserts every site
PR TrakHound#194 wraps in `#if NET5_0_OR_GREATER` still carries the
`[SupportedOSPlatform("windows")]` decoration when the build path
yields net8.0. The fixture covers the six sites from the May-22
warnings sweep — WindowsService, MTConnectAgentService,
MTConnectAdapterService, both `MTConnect.Applications.Service`
types (agent + adapter), and the
`Ceen.Httpd.HttpServer.AppDomainBridge.HandleRequest(SocketInformation,...)`
plus `HttpServer.RunClient(SocketInformation,...)` HTTP-server
sites — and pins the API surface so a future contributor who
removes the attribute or narrows the wrap fails the test.

The fixture runs only under net8.0 (the only TFM every test project
targets), so cannot directly fail under the pre-fix code. Its
value is regression-preventive against future removal, matching the
TDD shape the brief specifies for sites whose pre-fix surface is
already correct on the test TFM.

Extends the test csproj with reflection-only references to
MTConnect.NET-Services, MTConnect.NET-HTTP,
MTConnect.NET-Applications-Agents, and
MTConnect.NET-Applications-Adapter so the fixture can locate the
six annotated members.
Restores Release pack-ability across the full TFM matrix
(net461..net9.0 + netstandard2.0). Commit dd2eb42 (2026-05-22)
landed `[SupportedOSPlatform("windows")]` decorations on six
Service / HTTP-server types/methods to silence the CA1416
platform-compatibility analyzer on net8.0. The attribute type
ships in System.Runtime on .NET 5.0+ but is absent from net4x and
netstandard2.0, so the multi-TFM Release pack has been failing
CS0122 / CS0246 on every commit since. The CA1416 analyzer only
fires on net5+ too, so the attribute serves no purpose on older
TFMs.

Wraps each `using System.Runtime.Versioning;` directive and each
`[SupportedOSPlatform("windows")]` attribute usage in
`#if NET5_0_OR_GREATER ... #endif` so the older TFMs see neither.
No runtime behavior change on .NET 5.0+ — the decoration remains
in effect — and net4x / netstandard2.0 stop referencing a type
that does not ship there.

Sites covered:
  * libraries/MTConnect.NET-Services/WindowsService.cs
  * libraries/MTConnect.NET-Services/MTConnectAgentService.cs
  * libraries/MTConnect.NET-Services/MTConnectAdapterService.cs
  * libraries/MTConnect.NET-HTTP/Ceen/Httpd/HttpServer.cs (two
    attribute sites — AppDomainBridge.HandleRequest and
    HttpServer.RunClient overloads that take SocketInformation)
  * agent/MTConnect.NET-Applications-Agents/Service.cs
  * adapter/MTConnect.NET-Applications-Adapter/Service.cs

The SupportedOSPlatformAttributePresenceTests fixture added in
the preceding test commit goes from RED on net8.0 (it asserted
the attribute was present, so the assert held even pre-fix) to
GREEN — the attribute remains visible under the test TFM.
@ottobolyos
ottobolyos force-pushed the fix/multi-tfm-compat branch from ef9ea58 to 266887b Compare August 21, 2026 16:04
ottobolyos added a commit to ottobolyos/mtconnect.net that referenced this pull request Aug 21, 2026
ottobolyos added a commit to ottobolyos/mtconnect.net that referenced this pull request Aug 21, 2026
@ottobolyos
ottobolyos marked this pull request as ready for review August 21, 2026 20:51
@ottobolyos

Copy link
Copy Markdown
Contributor Author

@PatrickRitchie#218 is Completed + ready for review. Post-#230 merge, this became the new queue head; rebased on new master 976a8e1e, full-matrix bluefin dotnet test on the rebased tip 266887b0 returned rc=0 (5,137 tests passed, 0 failed — SHDR 40, MqttRelay 62, JSON 63, XML 98, JSON-cppagent 363, HTTP 112, Common 4102, Compliance 225, Docs 72 with 34m20s E2E). Six-agent Ultrareview cycles 2 + 3 clean. The false-premise LangVersion 8.0 bump from an earlier draft was reverted after upstream/master's XsdPreprocessor.cs was verified as already C# 7.3-compatible; PR shrunk to 2 commits — the SupportedOSPlatform presence-guard fix + its RED-first test pin.

Ready when you are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant