Skip to content

Commit 0d69283

Browse files
Merge pull request #182 from ottobolyos/feat/docs-full-coverage
feat(docs): expand API reference to every committed project
2 parents d4bd6ea + a115a3a commit 0d69283

154 files changed

Lines changed: 1183 additions & 35 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ jobs:
139139
run: npx vitepress build
140140
env:
141141
DOCS_BASE: /MTConnect.NET/
142+
# The flat 2 000-page API reference plus the unified server +
143+
# client bundles push rollup past the GitHub Actions runner's
144+
# default Node heap (~4 GB) during the markdown -> Vue
145+
# transform. The previous symptom was 'Ineffective
146+
# mark-compacts near heap limit' aborting the build with
147+
# exit 134 even though no page actually fails to parse. Lift
148+
# the cap to 8 GB -- runners have 16 GB of RAM, so this is
149+
# well within budget.
150+
NODE_OPTIONS: --max-old-space-size=8192
142151

143152
# Upload the built artifact only on the deploy path. PR builds stop
144153
# after the build step (success / failure surfaces in the check).

agent/Processors/MTConnect.NET-AgentProcessor-Python/MTConnect.NET-AgentProcessor-Python.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
<PrivateAssets>all</PrivateAssets>
4242
</PackageReference>
4343
<PackageReference Include="NLog" Version="5.2.7" />
44+
<!--
45+
IronPython's DynamicLanguageRuntime transitive (Microsoft.Scripting.dll)
46+
carries a strong-named reference to System.Configuration.ConfigurationManager
47+
8.0.0.0 even though its net8.0 nuspec drops the dependency (it was only
48+
declared on the netstandard2.0 group). Without an explicit reference here
49+
the assembly is never copied into bin/Debug/net8.0/, and `docfx metadata`
50+
emits `InvalidAssemblyReference` while walking the Python processor DLL's
51+
reference graph. Pinning it on the project that uses IronPython lands
52+
the assembly in the output directory so the docs build stays warning-free.
53+
-->
54+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
4455
</ItemGroup>
4556

4657
<ItemGroup>

docs/.docfx/docfx.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,29 @@
2525
"agent/Modules/MTConnect.NET-AgentModule-MqttBroker/bin/Debug/net8.0/MTConnect.NET-AgentModule-MqttBroker.dll",
2626
"agent/Modules/MTConnect.NET-AgentModule-MqttRelay/bin/Debug/net8.0/MTConnect.NET-AgentModule-MqttRelay.dll",
2727
"agent/Modules/MTConnect.NET-AgentModule-ShdrAdapter/bin/Debug/net8.0/MTConnect.NET-AgentModule-ShdrAdapter.dll",
28+
"agent/Processors/MTConnect.NET-AgentProcessor-Python/bin/Debug/net8.0/MTConnect.NET-AgentProcessor-Python.dll",
2829
"adapter/MTConnect.NET-Adapter/bin/Debug/net8.0/MTConnect.NET-Adapter.dll",
2930
"adapter/MTConnect.NET-Applications-Adapter/bin/Debug/net8.0/MTConnect.NET-Applications-Adapter.dll",
3031
"adapter/Modules/MTConnect.NET-AdapterModule-MQTT/bin/Debug/net8.0/MTConnect.NET-AdapterModule-MQTT.dll",
31-
"adapter/Modules/MTConnect.NET-AdapterModule-SHDR/bin/Debug/net8.0/MTConnect.NET-AdapterModule-SHDR.dll"
32+
"adapter/Modules/MTConnect.NET-AdapterModule-SHDR/bin/Debug/net8.0/MTConnect.NET-AdapterModule-SHDR.dll",
33+
"build/MTConnect.NET-SysML-Import/bin/Debug/net8.0/MTConnect.NET-SysML-Import.dll",
34+
"build/MTConnect.NET.Builder/bin/Debug/net8.0/MTConnect.NET.Builder.dll",
35+
"examples/MTConnect.NET-Agent-Embedded/bin/Debug/net8.0/MTConnect.NET-Agent-Embedded.dll",
36+
"examples/MTConnect.NET-Client-HTTP/bin/Debug/net8.0/MTConnect.NET-Client-HTTP.dll",
37+
"examples/MTConnect.NET-Client-MQTT/bin/Debug/net8.0/MTConnect.NET-Client-MQTT.dll",
38+
"examples/MTConnect.NET-Client-SHDR/bin/Debug/net8.0/MTConnect.NET-Client-SHDR.dll",
39+
"templates/mtconnect.net-agent/content/MTConnect.NET-Embedded-Agent/bin/Debug/net8.0/agent.dll",
40+
"tests/Compliance/MTConnect-Compliance-Tests/bin/Debug/net8.0/MTConnect-Compliance-Tests.dll",
41+
"tests/MTConnect.NET-AgentModule-MqttRelay-Tests/bin/Debug/net8.0/MTConnect.NET-AgentModule-MqttRelay-Tests.dll",
42+
"tests/MTConnect.NET-Common-Tests/bin/Debug/net8.0/MTConnect.NET-Common-Tests.dll",
43+
"tests/MTConnect.NET-Docs-Tests/bin/Debug/net8.0/MTConnect.NET-Docs-Tests.dll",
44+
"tests/MTConnect.NET-HTTP-Tests/bin/Debug/net8.0/MTConnect.NET-HTTP-Tests.dll",
45+
"tests/MTConnect.NET-Integration-Tests/bin/Debug/net8.0/MTConnect.NET-Integration-Tests.dll",
46+
"tests/MTConnect.NET-JSON-cppagent-Tests/bin/Debug/net8.0/MTConnect.NET-JSON-cppagent-Tests.dll",
47+
"tests/MTConnect.NET-JSON-Tests/bin/Debug/net8.0/MTConnect.NET-JSON-Tests.dll",
48+
"tests/MTConnect.NET-SHDR-Tests/bin/Debug/net8.0/MTConnect.NET-SHDR-Tests.dll",
49+
"tests/MTConnect.NET-Tests-Agents/bin/Debug/net8.0/MTConnect.NET-Tests-Agents.dll",
50+
"tests/MTConnect.NET-XML-Tests/bin/Debug/net8.0/MTConnect.NET-XML-Tests.dll"
3251
],
3352
"src": "../.."
3453
}

docs/.docfx/filter.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ apiRules:
22
- exclude:
33
uidRegex: ^Ceen($|\.)
44
type: Namespace
5+
# MTConnect.NET-DocsGen is the in-tree generator that produces the
6+
# docs/api/ Markdown tree itself, not a shipped public surface. Its
7+
# source DLL is intentionally absent from docfx.json, but the
8+
# MTConnect.NET-Docs-Tests assembly references DocsGen, so its
9+
# XML doc file (which embeds a six-space-indented bullet list of
10+
# bare <c> tags that VitePress's Vue template parser rejects as
11+
# "Element is missing end tag") is copy-local'd alongside the tests
12+
# DLL and re-discovered by docfx. Filter out the namespace as the
13+
# last-mile guard.
14+
- exclude:
15+
uidRegex: ^MTConnect\.NET_DocsGen($|\.)
16+
type: Namespace
517
# The legacy JSON v1 codec and the cppagent v2 codec each ship a type
618
# named JsonProcessFeed{r,R}ate inside MTConnect.Assets.Json.CuttingTools.
719
# The two pages collide on case-insensitive output paths (and on

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"predev": "npm run regen",
1010
"dev": "vitepress dev",
1111
"prebuild": "npm run regen",
12-
"build": "vitepress build",
12+
"build": "node --max-old-space-size=8192 node_modules/vitepress/bin/vitepress.js build",
1313
"preview": "vitepress preview",
1414
"check-links": "node scripts/check-broken-links.mjs ."
1515
},

docs/reference/environment-variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Every environment-variable reference discovered in the source tree. Both the C#
8484

8585
| Kind | Source | Default / value | Context |
8686
| --- | --- | --- | --- |
87-
| `csharp-read` | [`tests/Compliance/MTConnect-Compliance-Tests/L2_CrossImpl/CppAgentParityWorkflowTests.cs:488`](https://github.com/TrakHound/MTConnect.NET/blob/master/tests/Compliance/MTConnect-Compliance-Tests/L2_CrossImpl/CppAgentParityWorkflowTests.cs#L488) | | = Environment.GetEnvironmentVariable(FixtureDirEnv) |
87+
| `csharp-read` | [`tests/Compliance/MTConnect-Compliance-Tests/L2_CrossImpl/CppAgentParityWorkflowTests.cs:499`](https://github.com/TrakHound/MTConnect.NET/blob/master/tests/Compliance/MTConnect-Compliance-Tests/L2_CrossImpl/CppAgentParityWorkflowTests.cs#L499) | | = Environment.GetEnvironmentVariable(FixtureDirEnv) |
8888

8989
Adding a new `Environment.GetEnvironmentVariable("…")` call, a new `${MTCONNECT_…}` read in a contributor script, or a new `$env:MTCONNECT_…` reference in a PowerShell script without regenerating this page fails the validation test in CI.
9090

docs/scripts/generate-api-ref.sh

Lines changed: 122 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/usr/bin/env bash
22
# Generate the API reference Markdown under docs/api/.
33
#
4-
# Compiles every shipped MTConnect.NET library in Release / net8.0,
5-
# then runs `docfx metadata` against the produced DLLs and XML doc
6-
# files. The output is a flat tree of `Namespace.Type.md` pages
4+
# Compiles every committed MTConnect.NET project (libraries, agent and
5+
# adapter applications and modules, in-tree build / generator tools,
6+
# examples, the embedded-agent template, and the test suites) in
7+
# Debug, then runs `docfx metadata` against the produced DLLs and XML
8+
# doc files. The output is a flat tree of `Namespace.Type.md` pages
79
# alongside per-namespace landing pages.
810
#
911
# Usage:
@@ -24,7 +26,7 @@ for arg in "$@"; do
2426
case "${arg}" in
2527
--fast) skip_build=true ;;
2628
-h|--help)
27-
sed -n '2,15p' "${BASH_SOURCE[0]}"
29+
sed -n '2,17p' "${BASH_SOURCE[0]}"
2830
exit 0
2931
;;
3032
*)
@@ -34,6 +36,9 @@ for arg in "$@"; do
3436
esac
3537
done
3638

39+
# Path to the project directory. The csproj filename is inferred as
40+
# "<basename>.csproj" except where overridden in the matching entries
41+
# of csproj_overrides below.
3742
projects=(
3843
"libraries/MTConnect.NET-Common"
3944
"libraries/MTConnect.NET-DeviceFinder"
@@ -56,24 +61,60 @@ projects=(
5661
"agent/Modules/MTConnect.NET-AgentModule-MqttBroker"
5762
"agent/Modules/MTConnect.NET-AgentModule-MqttRelay"
5863
"agent/Modules/MTConnect.NET-AgentModule-ShdrAdapter"
64+
"agent/Processors/MTConnect.NET-AgentProcessor-Python"
5965
"adapter/MTConnect.NET-Adapter"
6066
"adapter/MTConnect.NET-Applications-Adapter"
6167
"adapter/Modules/MTConnect.NET-AdapterModule-MQTT"
6268
"adapter/Modules/MTConnect.NET-AdapterModule-SHDR"
69+
"build/MTConnect.NET-SysML-Import"
70+
"build/MTConnect.NET.Builder"
71+
"examples/MTConnect.NET-Agent-Embedded"
72+
"examples/MTConnect.NET-Client-HTTP"
73+
"examples/MTConnect.NET-Client-MQTT"
74+
"examples/MTConnect.NET-Client-SHDR"
75+
"templates/mtconnect.net-agent/content/MTConnect.NET-Embedded-Agent:Agent.csproj"
76+
"tests/Compliance/MTConnect-Compliance-Tests"
77+
"tests/MTConnect.NET-AgentModule-MqttRelay-Tests"
78+
"tests/MTConnect.NET-Common-Tests"
79+
"tests/MTConnect.NET-Docs-Tests"
80+
"tests/MTConnect.NET-HTTP-Tests"
81+
"tests/MTConnect.NET-Integration-Tests"
82+
"tests/MTConnect.NET-JSON-cppagent-Tests"
83+
"tests/MTConnect.NET-JSON-Tests"
84+
"tests/MTConnect.NET-SHDR-Tests"
85+
"tests/MTConnect.NET-Tests-Agents"
86+
"tests/MTConnect.NET-XML-Tests"
6387
)
6488

6589
if ! "${skip_build}"; then
66-
echo "==> building projects in Debug for net8.0"
67-
# Debug is the multi-target config that compiles ONLY net8.0 on every
68-
# project — Release multi-targets net4.6.1..net9.0 and fails on SDKs
69-
# that lack the legacy reference assemblies. The reference is content,
70-
# not packaged output, so a Debug build is fine.
71-
for proj in "${projects[@]}"; do
72-
name="$(basename "${proj}")"
73-
dotnet build "${proj}/${name}.csproj" \
90+
echo "==> building projects in Debug"
91+
# Debug is the multi-target config that compiles ONLY net8.0 on
92+
# every shipped project — Release multi-targets net4.6.1..net9.0 and
93+
# fails on SDKs that lack the legacy reference assemblies. The
94+
# reference is content, not packaged output, so a Debug build is
95+
# fine.
96+
for entry in "${projects[@]}"; do
97+
proj_dir="${entry%%:*}"
98+
if [[ "${entry}" == *:* ]]; then
99+
csproj_name="${entry##*:}"
100+
else
101+
csproj_name="$(basename "${proj_dir}").csproj"
102+
fi
103+
# Pass no NoWarn overrides. TreatWarningsAsErrors=true in
104+
# Directory.Build.props turns every XML-doc warning — including
105+
# CS1591 (missing XML doc on a public surface) — into a build
106+
# failure, which is the campaign's 100 % XML-doc-coverage gate.
107+
#
108+
# --no-incremental forces a from-source recompile. Without it,
109+
# an obj/ tree that was last produced under a CS1591-suppressed
110+
# build remains current and silently masks missing-doc errors:
111+
# MSBuild's up-to-date check looks at file timestamps and skips
112+
# csc altogether, so neither the new compiler flags nor the
113+
# diagnostic list takes effect.
114+
dotnet build "${proj_dir}/${csproj_name}" \
74115
-c Debug \
75116
-p:GenerateDocumentationFile=true \
76-
-p:AdditionalNoWarn=CS1591 \
117+
--no-incremental \
77118
--nologo \
78119
-v:quiet
79120
done
@@ -107,4 +148,72 @@ find docs/api -mindepth 1 -maxdepth 1 -not -name 'index.md' -exec rm -rf {} +
107148
find docs/api -name '*.md' -not -name 'index.md' -print0 \
108149
| xargs -0 sed -i -E 's#<code( [^>]*)?>#<code v-pre\1>#g'
109150

151+
# docfx emits two C#-generic patterns whose opening `<` is bare while
152+
# the closing `>` is markdown-escaped as `\>`. Vue's template compiler
153+
# then treats the bare `<` as the start tag of an element that never
154+
# closes (the escaped `\>` is rendered as a literal `>` in HTML, not
155+
# as an end-tag token), tripping "Element is missing end tag" at
156+
# vitepress build time. The two patterns are:
157+
#
158+
# 1. Heading text after the anchor close, e.g.
159+
# `### <a id="…"></a> Collect\(string, List<EnvVarInfo\>\)`.
160+
# 2. Return / parameter blocks where docfx renders an outer-generic
161+
# link followed by an inner-generic link, e.g.
162+
# ` [List](url-of-list)<[EnvVarInfo](url-of-envvarinfo)\>`.
163+
#
164+
# Both forms feed the parser a `<` followed by either an uppercase
165+
# letter (heading-text type name) or a `[` (markdown link opener) and
166+
# never close it with a real `</tag>`. Rewrite both bare opens as
167+
# `&lt;` HTML entities so the markdown -> HTML pipeline can't re-emit
168+
# a literal `<` (a backslash-escape would survive markdown but the
169+
# Vue template parser sees the rendered HTML, where `\<` decodes to
170+
# `<` again and re-trips the same error). The `<a id="…"></a>` anchor
171+
# itself is intentionally not touched -- `a` is lowercase, so the
172+
# `<[A-Z]` alternative misses it, and the `<\[` alternative is
173+
# unambiguous. Fenced code blocks render via the highlighter, not
174+
# Vue's template parser, so the bare generics they contain (e.g.
175+
# `public IReadOnlyList<EnvVarInfo> Collect(...)`) do not need
176+
# escaping. A small awk pass tracks ```-fence state and skips lines
177+
# inside fences so code-block content stays untouched.
178+
while IFS= read -r -d '' md_file; do
179+
awk '
180+
BEGIN { in_fence = 0 }
181+
/^```/ { in_fence = !in_fence; print; next }
182+
in_fence { print; next }
183+
{
184+
# Replace `<X` (uppercase) or `<[` with `&lt;X` / `&lt;[` by
185+
# walking each match.
186+
out = ""; s = $0
187+
while (match(s, /<([A-Z]|\[)/)) {
188+
out = out substr(s, 1, RSTART - 1) "&lt;" substr(s, RSTART + 1, RLENGTH - 1)
189+
s = substr(s, RSTART + RLENGTH)
190+
}
191+
line = out s
192+
# Replace `{{` with `&#123;&#123;` so Vue does not treat the
193+
# token as a mustache interpolation. docfx preserves verbatim
194+
# spec-marker text like `{{term(data set)}}` from XML doc
195+
# comments, which Vue would otherwise try to parse as the
196+
# JavaScript expression `term(data set)` and reject. The
197+
# html-entity form survives the markdown -> HTML pipeline.
198+
gsub(/\{\{/, "\\&#123;\\&#123;", line)
199+
# Escape `*` inside <code ...>...</code> spans as `&#42;`.
200+
# Without this, two `<code>*.sh</code>` spans on a single line
201+
# let markdown-it treat the `*` characters as the bookends of
202+
# an `<em>` span, producing `<em>.sh</code> and <code v-pre></em>`
203+
# in the rendered HTML -- with the `<code>` open/close braces
204+
# spliced into broken positions -- which then trips Vue with
205+
# "Element is missing end tag" during vitepress build.
206+
out2 = ""; t = line
207+
while (match(t, /<code( [^>]*)?>[^<]*<\/code>/)) {
208+
prefix = substr(t, 1, RSTART - 1)
209+
span = substr(t, RSTART, RLENGTH)
210+
gsub(/\*/, "\\&#42;", span)
211+
out2 = out2 prefix span
212+
t = substr(t, RSTART + RLENGTH)
213+
}
214+
print out2 t
215+
}
216+
' "${md_file}" > "${md_file}.tmp" && mv "${md_file}.tmp" "${md_file}"
217+
done < <(find docs/api -name '*.md' -not -name 'index.md' -print0)
218+
110219
echo "==> done. $(find docs/api -name '*.md' -not -name 'index.md' | wc -l) pages generated."

examples/MTConnect.NET-Agent-Embedded/Program.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,34 @@
1414

1515
// [ Module Configuration ]
1616
// This is where you can create a custom configuration section
17+
/// <summary>Represents the module configuration.</summary>
1718
public class ModuleConfiguration
1819
{
20+
/// <summary>Gets or sets the device uuid.</summary>
1921
public string DeviceUuid { get; set; }
22+
/// <summary>Gets or sets the device name.</summary>
2023
public string DeviceName { get; set; }
24+
/// <summary>Gets or sets the serial number.</summary>
2125
public string SerialNumber { get; set; }
2226
}
2327

2428

2529

2630
// [ Agent Module ]
2731
// This is the module that runs your code
32+
/// <summary>Represents the module.</summary>
2833
public class Module : MTConnectInputAgentModule
2934
{
35+
/// <summary>The configuration type id.</summary>
3036
public const string ConfigurationTypeId = "datasource"; // This must match the module section in the 'agent.config.yaml' file
37+
/// <summary>The default id.</summary>
3138
public const string DefaultId = "DataSource Module"; // The ID is mainly just used for logging.
3239
private readonly ModuleConfiguration _configuration;
3340

3441

42+
/// <summary>Initialises a new instance of the module type.</summary>
43+
/// <param name="agent">The agent.</param>
44+
/// <param name="configuration">The configuration.</param>
3545
public Module(IMTConnectAgentBroker agent, object configuration) : base(agent)
3646
{
3747
Id = DefaultId;

libraries/MTConnect.NET-DeviceFinder/MTConnectDeviceFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public class MTConnectDeviceFinder
125125
public event RequestStatusHandler SearchCompleted;
126126

127127

128-
/// <summary>Constructs the finder bound to the first reachable network interface; call <see cref="Start(int)"/> after configuring <see cref="Addresses"/> and <see cref="Ports"/>.</summary>
128+
/// <summary>Constructs the finder bound to the first reachable network interface; call <see cref="Start(bool)"/> after configuring <see cref="Addresses"/> and <see cref="Ports"/>.</summary>
129129
public MTConnectDeviceFinder()
130130
{
131131
Init();

libraries/MTConnect.NET-HTTP/Clients/MTConnectHttpCurrentClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public async Task<IStreamsResponseDocument> GetAsync(CancellationToken cancellat
266266
}
267267

268268

269-
/// <summary>Builds the <c>current</c> request URI from the client's own <see cref="MTConnectHttpClientRequest.Authority"/>, <see cref="MTConnectHttpClientRequest.Device"/>, <see cref="MTConnectHttpClientRequest.Path"/>, <see cref="At"/>, and <see cref="MTConnectHttpClientRequest.DocumentFormat"/>.</summary>
269+
/// <summary>Builds the <c>current</c> request URI from the client's own <see cref="Authority"/>, <see cref="Device"/>, <see cref="Path"/>, <see cref="At"/>, and <see cref="DocumentFormat"/>.</summary>
270270
public Uri CreateUri() => CreateUri(Authority, Device, Path, At, DocumentFormat);
271271

272272
/// <summary>Convenience overload that passes <c>0</c> for <paramref name="port"/>, taking the port from <paramref name="hostname"/> if present.</summary>

0 commit comments

Comments
 (0)