diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index a910d07e..116a1ae3 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-stryker": {
- "version": "5.0.0",
+ "version": "5.1.0",
"commands": [
"dotnet-stryker"
],
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bfd0a44b..6c98ef52 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -60,7 +60,7 @@ jobs:
fetch-depth: 0
- name: Set up .NET
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
+ uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# An exact version skips the aka.ms redirect of dotnet-install, which points at a retired storage account (HTTP 409).
dotnet-version: 10.0.403
@@ -188,7 +188,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up .NET
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
+ uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# An exact version skips the aka.ms redirect of dotnet-install, which points at a retired storage account (HTTP 409).
dotnet-version: 10.0.403
diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml
index d0bfe062..a9022578 100644
--- a/.github/workflows/dependency-check.yml
+++ b/.github/workflows/dependency-check.yml
@@ -24,7 +24,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up .NET
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
+ uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# An exact version skips the aka.ms redirect of dotnet-install, which points at a retired storage account (HTTP 409).
dotnet-version: 10.0.403
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index e838147e..d5f5263f 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -78,7 +78,7 @@ jobs:
ref: ${{ github.sha }}
- name: Set up .NET from global.json
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
+ uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# An exact version skips the aka.ms redirect of dotnet-install, which points at a retired storage account (HTTP 409).
dotnet-version: 10.0.403
diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml
index 41f180ca..001274ed 100644
--- a/.github/workflows/mutation.yml
+++ b/.github/workflows/mutation.yml
@@ -38,7 +38,7 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
+ - uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# An exact version skips the aka.ms redirect of dotnet-install, which points at a retired storage account (HTTP 409).
dotnet-version: 10.0.403
@@ -95,7 +95,7 @@ jobs:
timeout-minutes: 195
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
+ - uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# An exact version skips the aka.ms redirect of dotnet-install, which points at a retired storage account (HTTP 409).
dotnet-version: 10.0.403
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 3cd16e01..aafaac71 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -87,7 +87,7 @@ jobs:
fetch-depth: 0
- name: Set up .NET
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
+ uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# An exact version skips the aka.ms redirect of dotnet-install, which points at a retired storage account (HTTP 409).
dotnet-version: |
@@ -416,7 +416,7 @@ jobs:
- name: Confirm npm publication integrity
run: node tools/release/npm-release.mjs --require-published
- name: Set up .NET
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
+ uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# An exact version skips the aka.ms redirect of dotnet-install, which points at a retired storage account (HTTP 409).
dotnet-version: |
diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml
index 20a43afc..928defdb 100644
--- a/.github/workflows/site.yml
+++ b/.github/workflows/site.yml
@@ -21,7 +21,7 @@ jobs:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up .NET
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
+ uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# An exact version skips the aka.ms redirect of dotnet-install, which points at a retired storage account (HTTP 409).
dotnet-version: |
diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml
index b68a247a..3773275c 100644
--- a/.github/workflows/web.yml
+++ b/.github/workflows/web.yml
@@ -115,7 +115,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
+ - uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
# An exact version skips the aka.ms redirect of dotnet-install, which points at a retired storage account (HTTP 409).
dotnet-version: 10.0.403
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4a49997e..3f87cd30 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,28 @@ Related changes are consolidated; routine formatting and benchmark bookkeeping a
headings in this order and omits the empty ones: *Breaking changes* (each with its
migration), *Added*, *Changed*, *Fixed*, *Performance*, and *Documentation and tooling*.
+## Unreleased
+
+### Breaking changes
+
+- `StructValue.Add`, `ContainsKey`, `Remove` and `TryGetValue` name their first parameter `key`, matching the
+ dictionary interfaces they implement and `UnionValue`. Migration: callers that pass it as a named argument write
+ `key:` instead of `name:`; positional calls are unchanged.
+
+### Added
+
+- The Inspector recognizes Apple Core Audio Format (`.caf`) and DSDIFF (`.dff`) files, newly detected by `file-type`
+ 22.3.0, and shows each file header with its required first chunk (`desc` and `FVER`).
+
+### Documentation and tooling
+
+- Update build, test, documentation, benchmark and app dependencies to their latest compatible releases, including
+ StyleCop.Analyzers 1.3.180, MSTest 4.5.3, Stryker.NET 5.1.0, Vite 8.3.8, Vitest 5.1.0, ESLint 10.15.0, Playwright
+ 1.65.1, cspell 10.5.1, markdownlint-cli2 0.24.1 and `actions/setup-dotnet` 6.1.0. Source documentation now meets
+ StyleCop 1.3's rules for record parameters and partial types; the changed-documentation check accepts ``
+ on secondary partial declarations. The markdownlint-cli2 update removes a high-severity `re2js` advisory
+ (GHSA-gg6h-894w-4m9c) from the documentation toolchain.
+
## 0.18.0 — 2026-10-28
### Added
diff --git a/Directory.Build.props b/Directory.Build.props
index 5fd65ba7..c5a94acc 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -22,7 +22,7 @@
allruntime; build; native; contentfiles; analyzers; buildtransitive
-
+ allruntime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/README.md b/README.md
index 32b518f2..620e0156 100644
--- a/README.md
+++ b/README.md
@@ -361,44 +361,44 @@ reproduction commands, and the separate comparison against 0.11.1, including unc
-Measured on AMD Ryzen 9 9950X, Windows 11, .NET 10.0.12, with BenchmarkDotNet 0.15.8 (`default` job) on 2026-10-04. Times are medians for one record; each table lists the fastest deserializer first.
+Measured on AMD Ryzen 9 9950X, Windows 11, .NET 10.0.15, with BenchmarkDotNet 0.15.8 (`default` job) on 2026-11-16. Times are medians for one record; each table lists the fastest deserializer first.
**Same bytes: the 79-byte C layout**
| Approach | Deserialize | Allocated | Serialize | Allocated |
| ----------------------------------------------------------------------------- | ----------: | --------: | --------: | --------: |
-| CStructSharp generated view | 8.2 ns | 0 B | — | — |
-| .NET `MemoryMarshal.Read` / `Write` | 8.7 ns | 0 B | 0.2 ns | 0 B |
-| CStructSharp generated `Parse` / `Serialize` | 15.5 ns | 184 B | 8.4 ns | 0 B |
-| Hand-written `BinaryPrimitives` | 16.8 ns | 248 B | 5.2 ns | 0 B |
-| CStructSharp runtime view (`CreateView` + accessors) | 28.9 ns | 0 B | — | — |
-| CStructSharp runtime `ReadValue` / `Serialize` (layout-bound mapped class) | 30.3 ns | 248 B | 19.8 ns | 0 B |
-| .NET `BinaryReader` / `BinaryWriter` | 35.8 ns | 248 B | 40.0 ns | 0 B |
-| .NET `Marshal.PtrToStructure` / `StructureToPtr` | 50.1 ns | 128 B | 30.2 ns | 72 B |
-| Kaitai Struct 0.11.0 | 117 ns | 1,040 B | — | — |
-| CStructSharp runtime `Parse` + accessors | 127 ns | 672 B | — | — |
-| CStructSharp runtime `Parse` / `Serialize` (`StructValue`, path strings) | 329 ns | 672 B | 52.9 ns | 0 B |
+| .NET `MemoryMarshal.Read` / `Write` | 7.5 ns | 0 B | 0.2 ns | 0 B |
+| CStructSharp generated view | 8.5 ns | 0 B | — | — |
+| Hand-written `BinaryPrimitives` | 17.8 ns | 248 B | 5.4 ns | 0 B |
+| CStructSharp generated `Parse` / `Serialize` | 18.6 ns | 184 B | 8.8 ns | 0 B |
+| CStructSharp runtime view (`CreateView` + accessors) | 29.6 ns | 0 B | — | — |
+| CStructSharp runtime `ReadValue` / `Serialize` (layout-bound mapped class) | 32.9 ns | 248 B | 20.9 ns | 0 B |
+| .NET `BinaryReader` / `BinaryWriter` | 39.3 ns | 248 B | 40.2 ns | 0 B |
+| .NET `Marshal.PtrToStructure` / `StructureToPtr` | 53.3 ns | 128 B | 30.4 ns | 72 B |
+| CStructSharp runtime `Parse` + accessors | 135 ns | 672 B | — | — |
+| Kaitai Struct 0.11.0 | 152 ns | 1,040 B | — | — |
+| CStructSharp runtime `Parse` / `Serialize` (`StructValue`, path strings) | 363 ns | 672 B | 55.4 ns | 0 B |
**Same record, each library's own format**
| Library | Format | Size | Deserialize | Allocated | Serialize | Allocated |
| -------------------------------------------- | ---------------- | ----: | ----------: | --------: | --------: | --------: |
-| CStructSharp generated `Parse` / `Serialize` | C layout | 79 B | 15.5 ns | 184 B | 8.4 ns | 0 B |
-| FlatSharp 7.9.0 (lazy) | FlatBuffers | 116 B | 27.8 ns | 240 B | 46.1 ns | 0 B |
-| MemoryPack 1.21.4 | MemoryPack | 86 B | 31.9 ns | 248 B | 17.3 ns | 0 B |
-| MessagePack-CSharp 3.1.12 | MessagePack | 74 B | 110 ns | 248 B | 55.6 ns | 0 B |
-| protobuf-net 3.4.30 | Protocol Buffers | 91 B | 227 ns | 184 B | 221 ns | 0 B |
-| System.Text.Json (source-generated) | JSON | 207 B | 641 ns | 848 B | 355 ns | 0 B |
+| CStructSharp generated `Parse` / `Serialize` | C layout | 79 B | 18.6 ns | 184 B | 8.8 ns | 0 B |
+| FlatSharp 7.9.0 (lazy) | FlatBuffers | 116 B | 31.4 ns | 240 B | 47.0 ns | 0 B |
+| MemoryPack 1.22.0 | MemoryPack | 86 B | 34.5 ns | 248 B | 18.5 ns | 0 B |
+| MessagePack-CSharp 3.1.12 | MessagePack | 74 B | 111 ns | 248 B | 55.9 ns | 0 B |
+| protobuf-net 3.4.40 | Protocol Buffers | 91 B | 246 ns | 184 B | 214 ns | 0 B |
+| System.Text.Json (source-generated) | JSON | 207 B | 707 ns | 848 B | 370 ns | 0 B |
**A record whose shape depends on its data (the `packet` layout above)**
| Approach | Deserialize | Allocated | Serialize | Allocated |
| ---------------------------------------------------------------------- | ----------: | --------: | --------: | --------: |
-| Hand-written `BinaryPrimitives` | 24.6 ns | 208 B | 8.7 ns | 0 B |
-| CStructSharp generated `Parse` / `Serialize` | 48.7 ns | 200 B | 28.6 ns | 0 B |
-| CStructSharp runtime `Parse` + accessors / `Serialize` (`StructValue`) | 367 ns | 432 B | 237 ns | 0 B |
-| CStructSharp runtime `Parse` from a `MemoryStream` + accessors | 530 ns | 592 B | — | — |
-| CStructSharp runtime `ReadValue` / `Serialize` (mapped class) | 532 ns | 552 B | 396 ns | 272 B |
+| Hand-written `BinaryPrimitives` | 23.4 ns | 208 B | 8.3 ns | 0 B |
+| CStructSharp generated `Parse` / `Serialize` | 50.2 ns | 200 B | 27.2 ns | 0 B |
+| CStructSharp runtime `Parse` + accessors / `Serialize` (`StructValue`) | 368 ns | 432 B | 245 ns | 0 B |
+| CStructSharp runtime `ReadValue` / `Serialize` (mapped class) | 531 ns | 552 B | 359 ns | 272 B |
+| CStructSharp runtime `Parse` from a `MemoryStream` + accessors | 538 ns | 592 B | — | — |
diff --git a/apps/explorer/package.json b/apps/explorer/package.json
index 931a6e86..bbf7cf7b 100644
--- a/apps/explorer/package.json
+++ b/apps/explorer/package.json
@@ -26,7 +26,7 @@
"dependencies": {
"@cstructsharp/app-shared": "*",
"monaco-editor": "^0.57.0",
- "vue": "^3.5.44",
+ "vue": "^3.5.45",
"vuehex": "^0.7.0"
}
}
diff --git a/apps/inspector/package.json b/apps/inspector/package.json
index 06bd49ce..33274e1a 100644
--- a/apps/inspector/package.json
+++ b/apps/inspector/package.json
@@ -21,15 +21,15 @@
},
"dependencies": {
"@cstructsharp/app-shared": "*",
- "@iconify-icons/vscode-icons": "^2.0.17",
- "@iconify/vue": "^5.0.3",
+ "@iconify-icons/vscode-icons": "^2.0.26",
+ "@iconify/vue": "^5.0.5",
"@vueuse/core": "^15.0.0",
- "dockview-vue": "^8.6.0",
- "file-type": "22.1.1",
+ "dockview-vue": "^8.9.0",
+ "file-type": "22.3.0",
"json-editor-vue": "^0.19.2",
"monaco-editor": "^0.57.0",
"vanilla-jsoneditor": "^3.13.0",
- "vue": "^3.5.44",
+ "vue": "^3.5.45",
"vuehex": "^0.7.0"
}
}
diff --git a/apps/inspector/src/schema-catalog/audio.ts b/apps/inspector/src/schema-catalog/audio.ts
index dcef4617..27130c0e 100644
--- a/apps/inspector/src/schema-catalog/audio.ts
+++ b/apps/inspector/src/schema-catalog/audio.ts
@@ -83,6 +83,38 @@ uint64 chunk_size;
uint64 file_size;
uint64 metadata_offset;`,
},
+ {
+ extensions: ["dff"],
+ family: "DSDIFF",
+ scope:
+ "DSDIFF FRM8 form header and the required first FVER version chunk. Later property and sound-data chunks are not followed.",
+ fields: `char signature[4];
+uint64 form_size;
+char form_type[4];
+char version_chunk_type[4];
+uint64 version_chunk_size;
+uint32 format_version;`,
+ littleEndian: false,
+ },
+ {
+ extensions: ["caf"],
+ family: "Core Audio Format",
+ scope:
+ "CAF file header and the required first audio description chunk. Later chunks and audio packets are not followed.",
+ fields: `char signature[4];
+uint16 file_version;
+uint16 file_flags;
+char description_chunk_type[4];
+int64 description_chunk_size;
+float64 sample_rate;
+char format_id[4];
+uint32 format_flags;
+uint32 bytes_per_packet;
+uint32 frames_per_packet;
+uint32 channels_per_frame;
+uint32 bits_per_channel;`,
+ littleEndian: false,
+ },
{
extensions: ["wv"],
family: "WavPack",
diff --git a/apps/inspector/tests/e2e/schema-list.spec.ts b/apps/inspector/tests/e2e/schema-list.spec.ts
index d928eefe..8e2c672a 100644
--- a/apps/inspector/tests/e2e/schema-list.spec.ts
+++ b/apps/inspector/tests/e2e/schema-list.spec.ts
@@ -6,7 +6,7 @@ test("all detector types are listed and the filter searches extensions and names
}) => {
await page.goto("/");
const list = page.getByRole("navigation", { name: "Binary format examples" }).locator("ul");
- await expect(list.getByRole("button")).toHaveCount(185);
+ await expect(list.getByRole("button")).toHaveCount(187);
const labels = await list.locator(".example-title").allTextContents();
for (const extension of supportedExtensions) expect(labels).toContain(extension.toUpperCase());
const filter = page.getByRole("searchbox", { name: "Filter file types" });
@@ -18,7 +18,7 @@ test("all detector types are listed and the filter searches extensions and names
await filter.fill("no-such-file-type");
await expect(page.getByText("No matching file types.")).toBeVisible();
await page.getByRole("button", { name: "Clear file type filter" }).click();
- await expect(list.getByRole("button")).toHaveCount(185);
+ await expect(list.getByRole("button")).toHaveCount(187);
});
test("a catalog schema can be selected before loading a file and preserves that file on selection", async ({
diff --git a/apps/shared/package.json b/apps/shared/package.json
index 6719f42b..1ef20bb2 100644
--- a/apps/shared/package.json
+++ b/apps/shared/package.json
@@ -19,6 +19,6 @@
},
"peerDependencies": {
"monaco-editor": "^0.57.0",
- "vue": "^3.5.44"
+ "vue": "^3.5.45"
}
}
diff --git a/benchmarks/CStructSharp.Benchmarks/DevelopmentEnvironment.cs b/benchmarks/CStructSharp.Benchmarks/DevelopmentEnvironment.cs
index a787012f..de767cc3 100644
--- a/benchmarks/CStructSharp.Benchmarks/DevelopmentEnvironment.cs
+++ b/benchmarks/CStructSharp.Benchmarks/DevelopmentEnvironment.cs
@@ -40,7 +40,7 @@ public static Job Apply(Job job, string artifactsPath)
if (requested == "auto")
{
var cpus = new List();
- for (int cpu = 0; cpu < (IntPtr.Size * 8) - 1; cpu++)
+ for (int cpu = 0; cpu < (nint.Size * 8) - 1; cpu++)
{
if ((allowed & (1UL << cpu)) != 0)
{
@@ -56,7 +56,7 @@ public static Job Apply(Job job, string artifactsPath)
selectedCpu = cpus[cpus.Count / 2];
}
else if (int.TryParse(requested, NumberStyles.None, CultureInfo.InvariantCulture, out int cpu) &&
- cpu >= 0 && cpu < (IntPtr.Size * 8) - 1 && (allowed & (1UL << cpu)) != 0)
+ cpu >= 0 && cpu < (nint.Size * 8) - 1 && (allowed & (1UL << cpu)) != 0)
{
selectedCpu = cpu;
}
diff --git a/benchmarks/CStructSharp.Comparison/CStructSharp.Comparison.csproj b/benchmarks/CStructSharp.Comparison/CStructSharp.Comparison.csproj
index 47603933..e239f6ff 100644
--- a/benchmarks/CStructSharp.Comparison/CStructSharp.Comparison.csproj
+++ b/benchmarks/CStructSharp.Comparison/CStructSharp.Comparison.csproj
@@ -20,9 +20,9 @@
-
+
-
+
diff --git a/benchmarks/CStructSharp.Comparison/results.json b/benchmarks/CStructSharp.Comparison/results.json
index 428daefc..3455b50c 100644
--- a/benchmarks/CStructSharp.Comparison/results.json
+++ b/benchmarks/CStructSharp.Comparison/results.json
@@ -2,10 +2,10 @@
"environment": {
"processor": "AMD Ryzen 9 9950X",
"os": "Windows 11",
- "runtime": ".NET 10.0.12",
+ "runtime": ".NET 10.0.15",
"benchmarkDotNet": "0.15.8",
"job": "default",
- "date": "2026-10-04"
+ "date": "2026-11-16"
},
"sizes": {
"FlatBuffers": 116,
@@ -17,151 +17,151 @@
},
"cases": {
"DeserializeBenchmarks.CStructSharp_GeneratedParse": {
- "medianNanoseconds": 15.478,
+ "medianNanoseconds": 18.598,
"allocatedBytes": 184
},
"DeserializeBenchmarks.CStructSharp_GeneratedView": {
- "medianNanoseconds": 8.186,
+ "medianNanoseconds": 8.524,
"allocatedBytes": 0
},
"DeserializeBenchmarks.CStructSharp_RuntimeParse": {
- "medianNanoseconds": 328.769,
+ "medianNanoseconds": 363.268,
"allocatedBytes": 672
},
"DeserializeBenchmarks.CStructSharp_RuntimeParseAccessors": {
- "medianNanoseconds": 127.138,
+ "medianNanoseconds": 134.838,
"allocatedBytes": 672
},
"DeserializeBenchmarks.CStructSharp_RuntimeReadValue": {
- "medianNanoseconds": 30.292,
+ "medianNanoseconds": 32.946,
"allocatedBytes": 248
},
"DeserializeBenchmarks.CStructSharp_RuntimeView": {
- "medianNanoseconds": 28.886,
+ "medianNanoseconds": 29.604,
"allocatedBytes": 0
},
"DeserializeBenchmarks.HandWritten_BinaryPrimitives": {
- "medianNanoseconds": 16.751,
+ "medianNanoseconds": 17.78,
"allocatedBytes": 248
},
"DeserializeBenchmarks.Kaitai_Struct": {
- "medianNanoseconds": 117.428,
+ "medianNanoseconds": 152.095,
"allocatedBytes": 1040
},
"DeserializeBenchmarks.Own_FlatSharp": {
- "medianNanoseconds": 27.783,
+ "medianNanoseconds": 31.424,
"allocatedBytes": 240
},
"DeserializeBenchmarks.Own_MemoryPack": {
- "medianNanoseconds": 31.897,
+ "medianNanoseconds": 34.521,
"allocatedBytes": 248
},
"DeserializeBenchmarks.Own_MessagePack": {
- "medianNanoseconds": 110.267,
+ "medianNanoseconds": 110.852,
"allocatedBytes": 248
},
"DeserializeBenchmarks.Own_ProtobufNet": {
- "medianNanoseconds": 226.966,
+ "medianNanoseconds": 245.871,
"allocatedBytes": 184
},
"DeserializeBenchmarks.Own_SystemTextJson": {
- "medianNanoseconds": 641.063,
+ "medianNanoseconds": 707.292,
"allocatedBytes": 848
},
"DeserializeBenchmarks.Stock_BinaryReader": {
- "medianNanoseconds": 35.811,
+ "medianNanoseconds": 39.325,
"allocatedBytes": 248
},
"DeserializeBenchmarks.Stock_MarshalPtrToStructure": {
- "medianNanoseconds": 50.095,
+ "medianNanoseconds": 53.275,
"allocatedBytes": 128
},
"DeserializeBenchmarks.Stock_MemoryMarshal": {
- "medianNanoseconds": 8.674,
+ "medianNanoseconds": 7.539,
"allocatedBytes": 0
},
"SerializeBenchmarks.CStructSharp_GeneratedSerialize": {
- "medianNanoseconds": 8.396,
+ "medianNanoseconds": 8.755,
"allocatedBytes": 0
},
"SerializeBenchmarks.CStructSharp_RuntimeSerializeMapped": {
- "medianNanoseconds": 19.824,
+ "medianNanoseconds": 20.901,
"allocatedBytes": 0
},
"SerializeBenchmarks.CStructSharp_RuntimeSerializeStructValue": {
- "medianNanoseconds": 52.924,
+ "medianNanoseconds": 55.414,
"allocatedBytes": 0
},
"SerializeBenchmarks.HandWritten_BinaryPrimitives": {
- "medianNanoseconds": 5.224,
+ "medianNanoseconds": 5.358,
"allocatedBytes": 0
},
"SerializeBenchmarks.Own_FlatSharp": {
- "medianNanoseconds": 46.073,
+ "medianNanoseconds": 47.031,
"allocatedBytes": 0
},
"SerializeBenchmarks.Own_MemoryPack": {
- "medianNanoseconds": 17.26,
+ "medianNanoseconds": 18.52,
"allocatedBytes": 0
},
"SerializeBenchmarks.Own_MessagePack": {
- "medianNanoseconds": 55.574,
+ "medianNanoseconds": 55.914,
"allocatedBytes": 0
},
"SerializeBenchmarks.Own_ProtobufNet": {
- "medianNanoseconds": 220.632,
+ "medianNanoseconds": 214.03,
"allocatedBytes": 0
},
"SerializeBenchmarks.Own_SystemTextJson": {
- "medianNanoseconds": 355.075,
+ "medianNanoseconds": 370.416,
"allocatedBytes": 0
},
"SerializeBenchmarks.Stock_BinaryWriter": {
- "medianNanoseconds": 39.966,
+ "medianNanoseconds": 40.191,
"allocatedBytes": 0
},
"SerializeBenchmarks.Stock_MarshalStructureToPtr": {
- "medianNanoseconds": 30.232,
+ "medianNanoseconds": 30.361,
"allocatedBytes": 72
},
"SerializeBenchmarks.Stock_MemoryMarshal": {
- "medianNanoseconds": 0.232,
+ "medianNanoseconds": 0.229,
"allocatedBytes": 0
},
"VariableBenchmarks.Generated_Parse": {
- "medianNanoseconds": 48.739,
+ "medianNanoseconds": 50.235,
"allocatedBytes": 200
},
"VariableBenchmarks.Generated_Serialize": {
- "medianNanoseconds": 28.647,
+ "medianNanoseconds": 27.249,
"allocatedBytes": 0
},
"VariableBenchmarks.HandWritten_Read": {
- "medianNanoseconds": 24.552,
+ "medianNanoseconds": 23.418,
"allocatedBytes": 208
},
"VariableBenchmarks.HandWritten_Write": {
- "medianNanoseconds": 8.669,
+ "medianNanoseconds": 8.283,
"allocatedBytes": 0
},
"VariableBenchmarks.Runtime_Parse": {
- "medianNanoseconds": 367.065,
+ "medianNanoseconds": 367.78,
"allocatedBytes": 432
},
"VariableBenchmarks.Runtime_ParseStream": {
- "medianNanoseconds": 530.167,
+ "medianNanoseconds": 537.689,
"allocatedBytes": 592
},
"VariableBenchmarks.Runtime_ReadValueMapped": {
- "medianNanoseconds": 531.778,
+ "medianNanoseconds": 531.041,
"allocatedBytes": 552
},
"VariableBenchmarks.Runtime_SerializeMapped": {
- "medianNanoseconds": 395.682,
+ "medianNanoseconds": 358.675,
"allocatedBytes": 272
},
"VariableBenchmarks.Runtime_SerializeStructValue": {
- "medianNanoseconds": 237.448,
+ "medianNanoseconds": 245.119,
"allocatedBytes": 0
}
}
diff --git a/benchmarks/js/package-lock.json b/benchmarks/js/package-lock.json
index e05be6d2..19c8682e 100644
--- a/benchmarks/js/package-lock.json
+++ b/benchmarks/js/package-lock.json
@@ -8,21 +8,21 @@
"name": "cstructsharp-js-benchmarks",
"version": "0.0.0",
"devDependencies": {
- "playwright": "1.64.1",
- "tinybench": "6.2.2"
+ "playwright": "1.65.1",
+ "tinybench": "6.2.3"
},
"engines": {
"node": ">=22.14.0"
}
},
"node_modules/playwright": {
- "version": "1.64.1",
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.64.1.tgz",
- "integrity": "sha512-HCrVhHr5QQuwYoswEUGTb7gGp522yflbv/ST8nF4sFWGuLjQCt17Q/EubpGGSNKYn1tsTCPZxqHhHCfVURu7UA==",
+ "version": "1.65.1",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.1.tgz",
+ "integrity": "sha512-vJ1FuoOrNwOKHUIVEvSt3jT1L+wjjDpwhwIstKtfvTh8XIG4FG4bIFuvNdMxi81LGfAhUgUZleVFaOLY4RIUUw==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
- "playwright-core": "1.64.1"
+ "playwright-core": "1.65.1"
},
"bin": {
"playwright": "cli.js"
@@ -32,9 +32,9 @@
}
},
"node_modules/playwright-core": {
- "version": "1.64.1",
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.1.tgz",
- "integrity": "sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ==",
+ "version": "1.65.1",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.1.tgz",
+ "integrity": "sha512-hqPpz7blSMPxWVdoeE1yiBSzXsKiVOd2k+kjCvmUywD2GPO2Dd9HfcWnq9NN0GHbNZDFgZ9JfBFr+X5/BLo0qw==",
"dev": true,
"license": "Apache-2.0",
"bin": {
@@ -45,9 +45,9 @@
}
},
"node_modules/tinybench": {
- "version": "6.2.2",
- "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.2.tgz",
- "integrity": "sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA==",
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.3.tgz",
+ "integrity": "sha512-Al01C2JIBnO2CXCAPbpAl6sUiOZHeThGtHYNTa51JRw9PyWOCdr+9Ong05R4qg/Sk3+H645E8ov1h2c58ityNw==",
"dev": true,
"license": "MIT",
"engines": {
diff --git a/benchmarks/js/package.json b/benchmarks/js/package.json
index ad5538d7..cdf29bed 100644
--- a/benchmarks/js/package.json
+++ b/benchmarks/js/package.json
@@ -16,7 +16,7 @@
"profile:browser": "node bench/profile-browser.mjs"
},
"devDependencies": {
- "playwright": "1.64.1",
- "tinybench": "6.2.2"
+ "playwright": "1.65.1",
+ "tinybench": "6.2.3"
}
}
diff --git a/contracts/api/managed/CStructSharp.public-api.txt b/contracts/api/managed/CStructSharp.public-api.txt
index 57a29e04..8c039748 100644
--- a/contracts/api/managed/CStructSharp.public-api.txt
+++ b/contracts/api/managed/CStructSharp.public-api.txt
@@ -1363,19 +1363,19 @@ namespace CStructSharp.Values
public object? this[string name] { get; set; }
public System.Collections.Generic.ICollection Keys { get; }
public System.Collections.Generic.ICollection
diff --git a/src/CStructSharp.Generators/ContainingType.cs b/src/CStructSharp.Generators/ContainingType.cs
index 9f6a667a..863b4a5a 100644
--- a/src/CStructSharp.Generators/ContainingType.cs
+++ b/src/CStructSharp.Generators/ContainingType.cs
@@ -3,6 +3,8 @@ namespace CStructSharp.Generators;
using Microsoft.CodeAnalysis;
/// A type that contains the attributed class, outermost first.
+/// The declaration keyword that re-declares the type as partial; see .
+/// The type's simple name, without type parameters.
internal readonly record struct ContainingType(string Keyword, string Name)
{
///
diff --git a/src/CStructSharp.Generators/DefinitionLiteralShape.cs b/src/CStructSharp.Generators/DefinitionLiteralShape.cs
index f06847e9..842f7ff6 100644
--- a/src/CStructSharp.Generators/DefinitionLiteralShape.cs
+++ b/src/CStructSharp.Generators/DefinitionLiteralShape.cs
@@ -5,4 +5,7 @@ namespace CStructSharp.Generators;
/// string literal contributes its content start and the indentation it strips; anything else is located at the
/// whole argument.
///
+/// Whether the definition is a multi-line raw string literal; the other values are 0 otherwise.
+/// The zero-based source line of the literal's first content line, the one after the opening quotes.
+/// The number of leading whitespace characters the compiler strips from every content line.
internal readonly record struct DefinitionLiteralShape(bool IsRawMultiLine, int ContentStartLine, int Indentation);
diff --git a/src/CStructSharp.Generators/GeneratedModel.cs b/src/CStructSharp.Generators/GeneratedModel.cs
index 5c7bb645..dc5a4f11 100644
--- a/src/CStructSharp.Generators/GeneratedModel.cs
+++ b/src/CStructSharp.Generators/GeneratedModel.cs
@@ -478,9 +478,17 @@ private static string WrapArray(string element, int dimensions)
}
/// A layout enum and its C# enum.
+/// The C# enum name.
+/// The enum's name in the layout.
+/// The compiled enum with its integer codec and members.
+/// The C# keyword of the backing integer type, from sbyte to ulong.
+/// The C# members in declaration order.
internal sealed record GeneratedEnum(string Name, string LayoutName, CompiledEnumType Compiled, string UnderlyingType, IReadOnlyList Members);
/// One enum member with its value in the enum's own integer domain.
+/// The C# member name.
+/// The member's name in the layout.
+/// The member's mathematical value, signed or unsigned as the enum's integer type is.
internal sealed record GeneratedEnumMember(string Name, string LayoutName, System.Numerics.BigInteger Value);
/// A struct or union and its C# class.
@@ -525,6 +533,12 @@ public GeneratedComposite(string name, string layoutName, CompiledCompositeType
}
/// One property of a generated class and the compiled field it holds.
+/// The compiled field the property reads and writes.
+/// The C# property name.
+/// The generated class of the struct or union the field holds or points to; otherwise.
+/// The generated enum of an enum-typed field; otherwise.
+/// The C# property type, such as Pointer<T>, T[] or string.
+/// Whether the field is read only when its conditional arm is active.
internal sealed record GeneratedMember(CompiledField Field, string PropertyName, GeneratedComposite? Composite, GeneratedEnum? Enum, string TypeName, bool IsConditional)
{
/// Gets the member's name in the layout.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.Arrays.cs b/src/CStructSharp.Generators/LayoutEmitter.Arrays.cs
index 38fbc412..0601add8 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.Arrays.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.Arrays.cs
@@ -10,7 +10,7 @@ namespace CStructSharp.Generators;
using CStructSharp.Syntax;
using static CStructSharp.Generators.Emit;
-/// Array members: the element count (fixed, from an expression, to the end of the input, or terminated), the runtime's limits, and the element loop or bulk decode.
+/// Array members: the element count (fixed, from an expression, to the end of the input, or terminated), the runtime's limits, and the element loop or bulk decode.
internal sealed partial class LayoutEmitter
{
private readonly HashSet pointerReaders = new(StringComparer.Ordinal);
diff --git a/src/CStructSharp.Generators/LayoutEmitter.BitfieldReaders.cs b/src/CStructSharp.Generators/LayoutEmitter.BitfieldReaders.cs
index c67a90a0..8b9f2804 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.BitfieldReaders.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.BitfieldReaders.cs
@@ -6,7 +6,7 @@ namespace CStructSharp.Generators;
using CStructSharp.Compilation;
using static CStructSharp.Generators.Emit;
-/// Reader-only shortcuts for fixed bitfield leaves, with the original member reader retained for every failure.
+/// Reader-only shortcuts for fixed bitfield leaves, with the original member reader retained for every failure.
internal sealed partial class LayoutEmitter
{
private readonly Dictionary bitfieldLeafPlans = new(ReferenceEqualityComparer.Instance);
diff --git a/src/CStructSharp.Generators/LayoutEmitter.ByteOrder.cs b/src/CStructSharp.Generators/LayoutEmitter.ByteOrder.cs
index 5d67e612..68cda1a7 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.ByteOrder.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.ByteOrder.cs
@@ -4,14 +4,14 @@ namespace CStructSharp.Generators;
using CStructSharp.Compilation;
using static CStructSharp.Generators.Emit;
-///
+///
/// Run-time byte order (RuntimeByteOrder): a neutral value - one the layout spells without a < or
/// > suffix - is decoded with a byte order that the caller chooses when it reads, so one layout stands for
/// the little- and the big-endian pair. The emitter keeps the C# expression that names the order in the code being
/// written (cursor.LittleEndian in a reader, this.littleEndian in a view, littleEndian in a
/// helper with a parameter of that name); every site that decodes a neutral value uses it, and every explicit value
/// keeps its own literal.
-///
+///
internal sealed partial class LayoutEmitter
{
/// The expression naming the run-time byte order in the code being emitted, or when the order is fixed at build time.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.Constants.cs b/src/CStructSharp.Generators/LayoutEmitter.Constants.cs
index 14a152f3..4654a158 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.Constants.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.Constants.cs
@@ -4,10 +4,10 @@ namespace CStructSharp.Generators;
using System.Globalization;
using CStructSharp.Syntax;
-///
+///
/// The integer #defines of a layout, emitted as public const members of the generated class so code that
/// reads a header can name the layout's constants (Ext.EXT_MAGIC) instead of repeating their values.
-///
+///
internal sealed partial class LayoutEmitter
{
private List? defineConstants;
diff --git a/src/CStructSharp.Generators/LayoutEmitter.DeferredPointers.cs b/src/CStructSharp.Generators/LayoutEmitter.DeferredPointers.cs
index 3b65aa08..0e7ea2dc 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.DeferredPointers.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.DeferredPointers.cs
@@ -4,11 +4,11 @@ namespace CStructSharp.Generators;
using CStructSharp.Diagnostics;
using static CStructSharp.Generators.Emit;
-///
+///
/// Deferred pointers in the struct readers: a pointer field's address is read in declaration order, and its
/// target is followed after the struct's last field, as the runtime does. Following last lets a target's
/// @count(N) name a field declared after the pointer, and keeps the first failure the same as the runtime's.
-///
+///
internal sealed partial class LayoutEmitter
{
///
diff --git a/src/CStructSharp.Generators/LayoutEmitter.FixedBytesChecks.cs b/src/CStructSharp.Generators/LayoutEmitter.FixedBytesChecks.cs
index 97d89772..0cae4fad 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.FixedBytesChecks.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.FixedBytesChecks.cs
@@ -6,12 +6,12 @@ namespace CStructSharp.Generators;
using CStructSharp.Compilation;
using static CStructSharp.Generators.Emit;
-///
+///
/// The constraint pass of a fixed class-shaped struct that runs on the struct's bytes, before the object is built. A
/// non-throwing TryParse of input that breaks a condition then returns the failure without having allocated the value it
/// would throw away. The pass decodes only the members the conditions name, as Matches does, and evaluates the same
/// condition code in the same order, so it fails with the failure (and collects the violations) of the pass over the object.
-///
+///
internal sealed partial class LayoutEmitter
{
/// The members a bytes-first pass decodes, each with its place in the struct.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.FixedReaders.cs b/src/CStructSharp.Generators/LayoutEmitter.FixedReaders.cs
index 2ada77c8..95655b8c 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.FixedReaders.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.FixedReaders.cs
@@ -7,7 +7,7 @@ namespace CStructSharp.Generators;
using CStructSharp.Compilation;
using static CStructSharp.Generators.Emit;
-///
+///
/// The fixed readers: for a struct whose every member sits at an offset known at build time, a
/// Read<Type>Fixed(source, trimFixedText) that decodes each member at its constant offset, the
/// build-time counterpart of the runtime's static read plan. The composite's generated Read<Type> tries it first
@@ -15,7 +15,7 @@ namespace CStructSharp.Generators;
/// read exactly those bytes without a failure (enough input, within the read budget and the nesting and array
/// limits, and on the struct's alignment); any other input takes the member-by-member reader, which reports any
/// failure.
-///
+///
internal sealed partial class LayoutEmitter
{
// The eligibility of each composite, decided once; null for a composite that needs the member-by-member reader.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.FixedWriters.cs b/src/CStructSharp.Generators/LayoutEmitter.FixedWriters.cs
index b1e15f09..5f8cb783 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.FixedWriters.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.FixedWriters.cs
@@ -6,14 +6,14 @@ namespace CStructSharp.Generators;
using CStructSharp.Compilation;
using static CStructSharp.Generators.Emit;
-///
+///
/// The fixed writers: for a struct with a fixed reader whose members also encode without a possible failure
/// (numbers, enums, nested fixed structs, and fixed arrays of them - not text, whose characters are validated), an
/// Is<Type>FixedWritable(value) check and a Write<Type>Fixed(target, value) that stores
/// each member at its constant offset. The composite's Encode<Type> tries them first: the check confirms that no
/// nested value is null and every array has its declared length, and WriteCursor.TryReserveFixed hands over
/// cleared bytes only where the member-by-member writer would write exactly them. Anything else is written member by member.
-///
+///
internal sealed partial class LayoutEmitter
{
// Whether each composite has a fixed writer, decided once.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.Matches.cs b/src/CStructSharp.Generators/LayoutEmitter.Matches.cs
index 5cd7be35..a09f2570 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.Matches.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.Matches.cs
@@ -8,11 +8,11 @@ namespace CStructSharp.Generators;
using CStructSharp.Diagnostics;
using static CStructSharp.Generators.Emit;
-///
+///
/// Matches: a static, non-throwing recognition check for a struct with @expect or @magic conditions (a struct with an evaluable @magic condition is recognized by those alone). It decodes only
/// the members the conditions name, each at its build-time offset straight from the bytes, so a probe that asks "is this
/// the format?" builds no value, reads nothing else and throws nothing.
-///
+///
internal sealed partial class LayoutEmitter
{
/// One @expect or @magic condition Matches evaluates.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.Operations.cs b/src/CStructSharp.Generators/LayoutEmitter.Operations.cs
index b195fd9d..d9d2cf99 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.Operations.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.Operations.cs
@@ -8,12 +8,12 @@ namespace CStructSharp.Generators;
using CStructSharp.Compilation;
using static CStructSharp.Generators.Emit;
-///
+///
/// The operations beside reading and writing: the root class's ICStructGenerated implementation, the
/// Sizes/Offsets constants and typed Update setters of statically placed members, and the
/// path-based operations (ParseWithDebug, ResolveAddress, GetArrayLength, Update)
/// that run on the runtime layout.
-///
+///
internal sealed partial class LayoutEmitter
{
/// Emits the operations the surface keeps: the full surface's interface, path operations and setters, and every surface's constants.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.Readers.cs b/src/CStructSharp.Generators/LayoutEmitter.Readers.cs
index 535de54f..5ef98182 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.Readers.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.Readers.cs
@@ -11,11 +11,11 @@ namespace CStructSharp.Generators;
using CStructSharp.Syntax;
using static CStructSharp.Generators.Emit;
-///
+///
/// The readers: one Read<Type>(ref ReadCursor, variables) per composite that mirrors the runtime
/// reader step by step - the same placement cursor per composite, the same per-field placement, the same order
/// of checks and the same failure texts - plus the public Parse overloads that create the cursor.
-///
+///
internal sealed partial class LayoutEmitter
{
private const string Cursor = "global::CStructSharp.Generated.ReadCursor";
diff --git a/src/CStructSharp.Generators/LayoutEmitter.Scalar.cs b/src/CStructSharp.Generators/LayoutEmitter.Scalar.cs
index e1a0fe63..802e8eb2 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.Scalar.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.Scalar.cs
@@ -6,12 +6,12 @@ namespace CStructSharp.Generators;
using CStructSharp.Compilation;
using static CStructSharp.Generators.Emit;
-///
+///
/// Shape = Scalar: a layout whose root struct holds one number, enum or identifier becomes a static Parse that
/// returns that value. No class, no properties and no per-struct reader family are generated: a project with hundreds of
/// one-field layouts (a stored integer, a word, a magic number) writes a short method for each instead of a class and three
/// readers.
-///
+///
internal sealed partial class LayoutEmitter
{
/// Gets a value indicating whether the layout generates a scalar reader instead of types.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.Sequences.cs b/src/CStructSharp.Generators/LayoutEmitter.Sequences.cs
index a9074902..ed2dc449 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.Sequences.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.Sequences.cs
@@ -4,13 +4,13 @@ namespace CStructSharp.Generators;
using CStructSharp.Diagnostics;
using static CStructSharp.Generators.Emit;
-///
+///
/// Record sequences: Records<Name> over memory, a segmented sequence, or a stream and
/// Records<Name>Async over a stream (the root forms Records/RecordsAsync), each an
/// enumeration of one composite after another until the input ends, driven by the runtime's
/// RecordSequence over a generated reader that parses one record as its own region; and, for a composite
/// with a static size, the foreach-able <Name>View.Enumerate over views with no allocation.
-///
+///
internal sealed partial class LayoutEmitter
{
private const string Sequence = "global::CStructSharp.Generated.RecordSequence";
diff --git a/src/CStructSharp.Generators/LayoutEmitter.Types.cs b/src/CStructSharp.Generators/LayoutEmitter.Types.cs
index e878256b..db608ce7 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.Types.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.Types.cs
@@ -5,7 +5,7 @@ namespace CStructSharp.Generators;
using CStructSharp.Compilation;
using static CStructSharp.Generators.Emit;
-/// The types: one C# enum per layout enum, one class per struct or union, properties typed per §1.4.
+/// The types: one C# enum per layout enum, one class per struct or union, properties typed per §1.4.
internal sealed partial class LayoutEmitter
{
/// Emits the layout's enums, and the class of every struct and union unless the surface is views only.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.ValueTypes.cs b/src/CStructSharp.Generators/LayoutEmitter.ValueTypes.cs
index 1fd2c33d..bb9ef6b5 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.ValueTypes.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.ValueTypes.cs
@@ -7,12 +7,12 @@ namespace CStructSharp.Generators;
using CStructSharp.Compilation;
using static CStructSharp.Generators.Emit;
-///
+///
/// Shape = Struct: every struct of the layout becomes a C# struct whose members are public fields, so a read
/// allocates no object for the value. A fixed one-dimensional array of numbers is a generated inline array type
/// (InlineArrays.ByteArray4), so it needs no T[] either. Only layouts whose every member has a fixed
/// size and no reference-typed or data-dependent shape qualify; the others are reported as CSG014.
-///
+///
internal sealed partial class LayoutEmitter
{
/// The greatest value MaxValueBytes may take.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.ViewPlacement.cs b/src/CStructSharp.Generators/LayoutEmitter.ViewPlacement.cs
index 0c33aeba..fe5ed24f 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.ViewPlacement.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.ViewPlacement.cs
@@ -8,11 +8,11 @@ namespace CStructSharp.Generators;
using CStructSharp.Diagnostics;
using static CStructSharp.Generators.Emit;
-///
+///
/// Where a view finds each member. A member whose offset the layout compiler knows is read at a constant; a member
/// placed after a runtime-sized array is read at an offset the view computes from the members before it, with the
/// reader's own count checks. The plan also records which members the view can expose at all.
-///
+///
internal sealed partial class LayoutEmitter
{
/// The caller variables a view without variables evaluates expressions with: none, so the defines keep their defaults.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.Views.cs b/src/CStructSharp.Generators/LayoutEmitter.Views.cs
index c0b51449..9cbd7dff 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.Views.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.Views.cs
@@ -8,14 +8,14 @@ namespace CStructSharp.Generators;
using CStructSharp.Compilation;
using static CStructSharp.Generators.Emit;
-///
+///
/// The views: one readonly ref struct <Type>View per composite over the composite's bytes, with a
/// direct decode at a constant offset for every statically placed scalar, a nested view for a statically placed
/// struct, the raw bytes, one element and a bulk copy of a numeric array (fixed, or sized by earlier members), text
/// and custom codec members, and ToObject() for everything else. A member after a runtime-sized array is read at
/// an offset the view computes from the members before it. Nothing is allocated until a string, a custom codec value,
/// or ToObject() is asked for.
-///
+///
internal sealed partial class LayoutEmitter
{
/// Emits the view of every composite, unless views are switched off.
diff --git a/src/CStructSharp.Generators/LayoutEmitter.Writers.cs b/src/CStructSharp.Generators/LayoutEmitter.Writers.cs
index 23716a1f..0bdb5b90 100644
--- a/src/CStructSharp.Generators/LayoutEmitter.Writers.cs
+++ b/src/CStructSharp.Generators/LayoutEmitter.Writers.cs
@@ -10,12 +10,12 @@ namespace CStructSharp.Generators;
using CStructSharp.Syntax;
using static CStructSharp.Generators.Emit;
-///
+///
/// The writers: one Encode<Type>(ref WriteCursor, value, variables) per composite that mirrors the
/// runtime writer step by step - the same placement, the same validation order and texts (array length, string
/// capacity, value range, bitfield width), the same union and padding rules - plus the public Serialize
/// and Write overloads that create the cursor.
-///
+///
internal sealed partial class LayoutEmitter
{
private const string WriteCursorType = "global::CStructSharp.Generated.WriteCursor";
diff --git a/src/CStructSharp.Generators/LayoutRequest.cs b/src/CStructSharp.Generators/LayoutRequest.cs
index 261b5caf..9e50e653 100644
--- a/src/CStructSharp.Generators/LayoutRequest.cs
+++ b/src/CStructSharp.Generators/LayoutRequest.cs
@@ -6,16 +6,44 @@ namespace CStructSharp.Generators;
/// ), so the incremental pipeline re-runs generation only when something the
/// output depends on changed.
///
-///
-/// TypesWithConstructors names the nested classes of the attributed class for which the consumer declared
-/// an instance constructor in a partial declaration. The generated class of such a composite may not hold the new
-/// nested values its property initializers create once construction ends, so its fixed reader replaces them
-/// instead of decoding into them.
-/// ConsumerDeclaredClasses names those nested types that the consumer declared as classes, which a value-type shape
-/// cannot extend (a partial declaration must keep one kind).
-/// ConsumerDeclaredTypes also includes partial declarations with an implicit constructor: their instance
-/// initializers may run caller code, so reader-only bitfield shortcuts leave those classes on the original path.
-///
+/// The attributed class's simple name.
+/// The containing namespace; for the global namespace.
+/// The types that contain the attributed class, outermost first.
+/// The attributed class's declared accessibility keyword, such as public.
+/// Whether the attributed class is declared static.
+/// Whether the attributed class is declared partial.
+/// Whether every containing type is declared partial.
+/// The inline layout text; when the layout comes from .
+/// The project-relative path of the .cstruct additional file; for an inline layout.
+/// The declaration the plain Parse/Serialize methods use; for the first struct.
+/// The layout settings (alignment, byte order, pointer size and the like) the attribute names.
+/// Whether generated names keep the layout's spelling instead of becoming PascalCase.
+/// Whether a ref struct view is generated per composite.
+/// Whether each view of a fixed-size struct gets a foreach enumerator over consecutive records.
+/// Whether the byte order of neutral values is chosen when a value is read instead of at compile time.
+/// Whether composites become classes, value types, or a one-member value.
+/// The largest struct, in bytes, that a value-type shape may generate.
+/// How much code is generated.
+/// Whether a failed constraint throws a format exception ( or ) instead of the constraint exception.
+/// The attribute's source location, for diagnostics.
+/// The inline definition argument's source location; when there is none.
+/// How the definition literal is written, to place layout errors inside it.
+/// The consumer's effective C# language version, as the compiler displays it.
+///
+/// The nested classes of the attributed class for which the consumer declared an instance constructor in a partial
+/// declaration. The generated class of such a composite may not hold the new nested values its property
+/// initializers create once construction ends, so its fixed reader replaces them instead of decoding into them.
+///
+///
+/// Every nested type the consumer declared, including partial declarations with an implicit constructor: their
+/// instance initializers may run caller code, so reader-only bitfield shortcuts leave those classes on the
+/// original path.
+///
+///
+/// The nested types the consumer declared as classes, which a value-type shape cannot extend (a partial
+/// declaration must keep one kind).
+///
+/// The named attribute arguments that choose an option, so a project default does not replace them.
internal sealed record LayoutRequest(
string ClassName,
string? Namespace,
diff --git a/src/CStructSharp.Generators/MappedMember.cs b/src/CStructSharp.Generators/MappedMember.cs
index b094013f..fef56b30 100644
--- a/src/CStructSharp.Generators/MappedMember.cs
+++ b/src/CStructSharp.Generators/MappedMember.cs
@@ -4,6 +4,16 @@ namespace CStructSharp.Generators;
/// One property of a mapped class, as the transform step extracted it. classifies the
/// property type for the direct members of a layout-bound class (see MappedFixedEmitter).
///
+/// The C# property name.
+/// The field name given by the property's member attribute; to map by property name.
+/// The fully qualified property type, with a nullable value type unwrapped.
+/// How the property maps, which decides the code emitted for it.
+/// The fully qualified element or pointer target type of a collection or typed pointer; empty otherwise.
+/// Whether the property type is a nullable value type (T?).
+/// Whether the property's setter is init-only.
+/// The type CSG101 reports for an member; empty otherwise.
+/// The property's source location, for diagnostics.
+/// The type's classification for the direct members of a layout-bound class.
internal sealed record MappedMember(
string PropertyName,
string? LayoutName,
diff --git a/src/CStructSharp.Generators/MappedRequest.cs b/src/CStructSharp.Generators/MappedRequest.cs
index cf224dce..fa7cb811 100644
--- a/src/CStructSharp.Generators/MappedRequest.cs
+++ b/src/CStructSharp.Generators/MappedRequest.cs
@@ -1,6 +1,17 @@
namespace CStructSharp.Generators;
/// Everything the generator needs from one [CStructMapped] type, with value equality for the incremental pipeline.
+/// The attributed type's simple name.
+/// The containing namespace; for the global namespace.
+/// The types that contain the attributed type, outermost first.
+/// The attributed type's declared accessibility keyword, such as public.
+/// The declaration keyword that re-declares the type as partial; see .
+/// Whether the attributed type is declared partial.
+/// Whether every containing type is declared partial.
+/// Whether the mapper can create the type: a value type, or a class with an internal or public parameterless constructor.
+/// The Layout argument naming the layout struct for direct members; when not given.
+/// The public settable instance properties the mapper fills, in declaration order.
+/// The attribute's source location, for diagnostics.
internal sealed record MappedRequest(
string ClassName,
string? Namespace,
diff --git a/src/CStructSharp.Generators/SourceSpan.cs b/src/CStructSharp.Generators/SourceSpan.cs
index b49702fe..3e4d61a2 100644
--- a/src/CStructSharp.Generators/SourceSpan.cs
+++ b/src/CStructSharp.Generators/SourceSpan.cs
@@ -4,6 +4,13 @@ namespace CStructSharp.Generators;
using Microsoft.CodeAnalysis.Text;
/// A location in the consumer's source, kept as values so the request record stays equatable.
+/// The source file's path; empty for a location outside a syntax tree.
+/// The zero-based character offset of the span's start in the file.
+/// The span's length in characters.
+/// The zero-based line of the span's start.
+/// The zero-based character position of the span's start within its line.
+/// The zero-based line of the span's end.
+/// The zero-based character position of the span's end within its line.
internal readonly record struct SourceSpan(string FilePath, int Start, int Length, int StartLine, int StartCharacter, int EndLine, int EndCharacter)
{
/// Copies a Roslyn location's file path, character span and line positions into a value.
diff --git a/src/CStructSharp.Wasm/CStructInteropBoundary.cs b/src/CStructSharp.Wasm/CStructInteropBoundary.cs
index 62a41267..c240fb50 100644
--- a/src/CStructSharp.Wasm/CStructInteropBoundary.cs
+++ b/src/CStructSharp.Wasm/CStructInteropBoundary.cs
@@ -10,7 +10,7 @@ namespace CStructSharpWeb.Wasm;
using CStructSharp.Syntax;
using Enum = System.Enum;
-/// Validates untrusted browser inputs and categorizes failures for the result envelope.
+/// Validates untrusted browser inputs and categorizes failures for the result envelope.
public partial class CStructExports
{
private const int InteropContractVersion = 10;
diff --git a/src/CStructSharp.Wasm/CStructJsonConversion.cs b/src/CStructSharp.Wasm/CStructJsonConversion.cs
index f0ffece8..9d62046e 100644
--- a/src/CStructSharp.Wasm/CStructJsonConversion.cs
+++ b/src/CStructSharp.Wasm/CStructJsonConversion.cs
@@ -8,7 +8,7 @@ namespace CStructSharpWeb.Wasm;
using CStructSharp;
using CStructSharp.Values;
-/// Contains the explicit rules that convert browser JSON input into the values the core writer accepts.
+/// Contains the explicit rules that convert browser JSON input into the values the core writer accepts.
public partial class CStructExports
{
/// Converts browser JSON into the primitive, expando, and list values accepted by the core writer.
diff --git a/src/CStructSharp.Wasm/InteropEnvelope.cs b/src/CStructSharp.Wasm/InteropEnvelope.cs
index d972f2c9..fefcde6f 100644
--- a/src/CStructSharp.Wasm/InteropEnvelope.cs
+++ b/src/CStructSharp.Wasm/InteropEnvelope.cs
@@ -6,7 +6,7 @@ namespace CStructSharpWeb.Wasm;
using System.Text;
using CStructSharp.Diagnostics;
-///
+///
/// Writes the versioned result envelope every browser export returns, through the one
/// . An envelope is one JSON object with seven members, always in this order:
/// contractVersion (), operation (the export's operation name),
@@ -14,7 +14,7 @@ namespace CStructSharpWeb.Wasm;
/// failure), debug (the byte ranges of a debug parse, otherwise empty), and error (null on success,
/// the fields on failure). The parse exports return the envelope as UTF-8 bytes,
/// every other export as a string; either way it is at most bytes.
-///
+///
public partial class CStructExports
{
private static readonly byte[] EnvelopeHead = Encoding.UTF8.GetBytes("{\"contractVersion\":" + InteropContractVersion.ToString(CultureInfo.InvariantCulture) + ",\"operation\":");
diff --git a/src/CStructSharp.Wasm/StaticPlanExport.cs b/src/CStructSharp.Wasm/StaticPlanExport.cs
index f3ef215c..ebf65b43 100644
--- a/src/CStructSharp.Wasm/StaticPlanExport.cs
+++ b/src/CStructSharp.Wasm/StaticPlanExport.cs
@@ -11,12 +11,12 @@ namespace CStructSharpWeb.Wasm;
using CStructSharp.Reading;
using CStructSharp.Syntax;
-///
+///
/// Describes a fully fixed root composite (its static read plan) as JSON so the JavaScript side can
/// read such layouts with DataView alone. The description is the compiler's own operation list — offsets,
/// codecs, counts, nested plans, enum member tables — not a second grammar; the JavaScript executor reproduces
/// the JSON projection's value shapes and falls back to WebAssembly for anything the plan does not cover.
-///
+///
[SupportedOSPlatform("browser")]
public partial class CStructExports
{
diff --git a/src/CStructSharp/CStructAccessors.cs b/src/CStructSharp/CStructAccessors.cs
index d9195a00..ad08dba9 100644
--- a/src/CStructSharp/CStructAccessors.cs
+++ b/src/CStructSharp/CStructAccessors.cs
@@ -10,11 +10,11 @@ namespace CStructSharp;
using CStructSharp.Reading;
using CStructSharp.Syntax;
-///
+///
/// Prepared reads: resolves a member path once into a
/// , and wraps
/// the bytes of one struct in a that reads members on demand without building values.
-///
+///
public sealed partial class CStruct
{
// Accessors StructView.Get(string) resolved, keyed by root, path and type; bounded for callers that build
diff --git a/src/CStructSharp/CStructDirectReads.cs b/src/CStructSharp/CStructDirectReads.cs
index 831d51cc..b45f318e 100644
--- a/src/CStructSharp/CStructDirectReads.cs
+++ b/src/CStructSharp/CStructDirectReads.cs
@@ -14,12 +14,12 @@ namespace CStructSharp;
using CStructSharp.Syntax;
using CStructSharp.Values;
-///
+///
/// The direct read of a whole fixed-layout root from memory: Parse(bytes, "header") and
/// ReadValue<T>(bytes, "header") for a struct whose every member has a fixed offset. The compiled engine
/// would build the per-operation state and slots, resolve the path, and then run the same
/// over the same bytes; this path runs the plan straight over the span.
-///
+///
///
/// The direct path is taken only when it cannot behave differently from the compiled engine: no caller variables,
/// no debug records, valid limits that the plan is known to satisfy, and enough input. Every other call, and every
diff --git a/src/CStructSharp/CStructDirectWrites.cs b/src/CStructSharp/CStructDirectWrites.cs
index 2f476330..36192638 100644
--- a/src/CStructSharp/CStructDirectWrites.cs
+++ b/src/CStructSharp/CStructDirectWrites.cs
@@ -9,12 +9,12 @@ namespace CStructSharp;
using CStructSharp.Values;
using CStructSharp.Writing;
-///
+///
/// The direct write of a whole fixed-layout root into caller memory: Serialize(span, "header", value) for a
/// struct whose every member has a fixed offset. The write engine would build the per-operation state and a
/// budgeted destination over the span, stage the struct in a block through its static write plan, and copy the
/// block out; this path runs the same plan over the same kind of staging block without the destination and state.
-///
+///
///
/// The direct path is taken only when it cannot behave differently from the write engine: no caller variables,
/// a value that is not null, valid limits that the plan is known to satisfy, and a destination large enough for
diff --git a/src/CStructSharp/CStructEngineReads.cs b/src/CStructSharp/CStructEngineReads.cs
index 4073c5ee..8debbdbd 100644
--- a/src/CStructSharp/CStructEngineReads.cs
+++ b/src/CStructSharp/CStructEngineReads.cs
@@ -12,10 +12,10 @@ namespace CStructSharp;
using CStructSharp.Syntax;
using CStructSharp.Values;
-///
+///
/// The whole-root reads, nested parses and debug parses of the compiled engine, and its capture of the layout an update
/// compares.
-///
+///
public sealed partial class CStruct
{
///
diff --git a/src/CStructSharp/CStructEngineUpdate.cs b/src/CStructSharp/CStructEngineUpdate.cs
index 234373bb..8981736a 100644
--- a/src/CStructSharp/CStructEngineUpdate.cs
+++ b/src/CStructSharp/CStructEngineUpdate.cs
@@ -12,10 +12,10 @@ namespace CStructSharp;
using CStructSharp.Streams;
using CStructSharp.Syntax;
-///
+///
/// The update of the compiled engine: the path resolved by the engine's path resolver, the replacement staged by its
/// writer, and the layout captured and compared by its debug programs, all over the operation's variable slots.
-///
+///
public sealed partial class CStruct
{
/// The failure of an update whose terminated value changes its encoded length and so moves later fields.
diff --git a/src/CStructSharp/CStructIntrospection.cs b/src/CStructSharp/CStructIntrospection.cs
index 0bbf1f4e..f8db5ed7 100644
--- a/src/CStructSharp/CStructIntrospection.cs
+++ b/src/CStructSharp/CStructIntrospection.cs
@@ -10,10 +10,10 @@ namespace CStructSharp;
using CStructSharp.Syntax;
using CstructEnum = CStructSharp.Syntax.Enum;
-///
+///
/// The read-only description of a compiled layout (), its rendering back to Portable text
/// (), and sibling layouts compiled from the same source with one option changed.
-///
+///
public sealed partial class CStruct
{
///
diff --git a/src/CStructSharp/CStructMatches.cs b/src/CStructSharp/CStructMatches.cs
index bd69d0f1..f2df4dda 100644
--- a/src/CStructSharp/CStructMatches.cs
+++ b/src/CStructSharp/CStructMatches.cs
@@ -10,10 +10,10 @@ namespace CStructSharp;
using CStructSharp.Expressions;
using CStructSharp.Syntax;
-///
+///
/// : the recognition check of the generated
/// layouts' Matches, for a layout that is compiled at run time.
-///
+///
public sealed partial class CStruct
{
///
diff --git a/src/CStructSharp/CStructMemoryIo.cs b/src/CStructSharp/CStructMemoryIo.cs
index ba2c84da..39f0d9d9 100644
--- a/src/CStructSharp/CStructMemoryIo.cs
+++ b/src/CStructSharp/CStructMemoryIo.cs
@@ -14,10 +14,10 @@ namespace CStructSharp;
using CStructSharp.Values;
using CStructSharp.Writing;
-///
+///
/// Provides synchronous zero-copy memory input and caller-owned memory output entry points. Pointer coordinates
/// are zero-based within the supplied input or newly serialized output region.
-///
+///
public sealed partial class CStruct
{
///
diff --git a/src/CStructSharp/CStructOperations.Async.cs b/src/CStructSharp/CStructOperations.Async.cs
index 96559f9b..b0882a69 100644
--- a/src/CStructSharp/CStructOperations.Async.cs
+++ b/src/CStructSharp/CStructOperations.Async.cs
@@ -12,7 +12,7 @@ namespace CStructSharp;
using CStructSharp.Streams;
using CStructSharp.Values;
-///
+///
/// The awaitable forms of the read operations. Each reads the stream into a pooled buffer with
/// - first a seekable stream up to its remaining
/// length, any stream up to plus one byte - and runs the synchronous
@@ -27,7 +27,7 @@ namespace CStructSharp;
/// Because the buffered region starts at the origin, a stored absolute pointer address counts from the origin -
/// as in the span and memory forms - where the synchronous stream form counts from the stream's first byte; a
/// stream whose addresses are absolute stream positions is read from position 0 or through the synchronous form.
-///
+///
public sealed partial class CStruct
{
/// A synchronous read over borrowed bytes that the async forms run once the input is buffered.
diff --git a/src/CStructSharp/CStructOperations.AsyncWrite.cs b/src/CStructSharp/CStructOperations.AsyncWrite.cs
index 69244aa2..2ceda96a 100644
--- a/src/CStructSharp/CStructOperations.AsyncWrite.cs
+++ b/src/CStructSharp/CStructOperations.AsyncWrite.cs
@@ -10,14 +10,14 @@ namespace CStructSharp;
using CStructSharp.Expressions;
using CStructSharp.Streams;
-///
+///
/// The awaitable write forms. serializes the value first (the validation the synchronous
/// writer performs, nothing written on a failure) and writes the bytes with one
/// . needs a
/// seekable stream: the region from the current position is read into a buffer, the in-place update runs over it,
/// and only the byte ranges that changed are written back; the position is the origin afterwards. As in the
/// span form, a stored absolute pointer address counts from the region's origin.
-///
+///
public sealed partial class CStruct
{
/// Serializes a root or selected value and writes it at the stream's current position.
diff --git a/src/CStructSharp/CStructOperations.Sequences.cs b/src/CStructSharp/CStructOperations.Sequences.cs
index d79eae82..358b30da 100644
--- a/src/CStructSharp/CStructOperations.Sequences.cs
+++ b/src/CStructSharp/CStructOperations.Sequences.cs
@@ -15,7 +15,7 @@ namespace CStructSharp;
using CStructSharp.Streams;
using CStructSharp.Values;
-///
+///
/// The forms of the read operations, for input that arrives in segments (a
/// PipeReader, a chain of pooled buffers). A single-segment sequence takes the span path with no copy; a
/// multi-segment one is copied into a pooled buffer - first at most
@@ -32,7 +32,7 @@ namespace CStructSharp;
/// address counts from the record's first byte; the synchronous stream form parses each record from the caller's
/// stream as Parse(Stream) does, so there it counts from the stream's first byte.
///
-///
+///
public sealed partial class CStruct
{
/// The span form of a read operation that a sequence form runs over its buffered copy.
diff --git a/src/CStructSharp/CStructOperations.cs b/src/CStructSharp/CStructOperations.cs
index 2bb057f6..6886c856 100644
--- a/src/CStructSharp/CStructOperations.cs
+++ b/src/CStructSharp/CStructOperations.cs
@@ -11,13 +11,13 @@ namespace CStructSharp;
using CStructSharp.Streams;
using CStructSharp.Values;
-///
+///
/// The public operations of a compiled layout. Every operation exists for a (reading
/// starts at its current position) and for in-memory input (,
/// , or a byte array, whose start is coordinate zero), with the same parameters
/// in the same order: the input, the root name or path, then the optional variables and options. An omitted
/// or path selects the first struct or union the layout declares.
-///
+///
public sealed partial class CStruct
{
// ------------------------------------------------------------------------------------------------------ Parse
diff --git a/src/CStructSharp/CStructPrimitiveCodecs.cs b/src/CStructSharp/CStructPrimitiveCodecs.cs
index 6f5d0593..dd8dc675 100644
--- a/src/CStructSharp/CStructPrimitiveCodecs.cs
+++ b/src/CStructSharp/CStructPrimitiveCodecs.cs
@@ -10,7 +10,7 @@ namespace CStructSharp;
using CStructSharp.Compilation;
using CStructSharp.Reading;
-/// Builds the primitive writer table used by the CStruct facade.
+/// Builds the primitive writer table used by the CStruct facade.
public sealed partial class CStruct
{
///
diff --git a/src/CStructSharp/CStructSyntheticRoots.cs b/src/CStructSharp/CStructSyntheticRoots.cs
index 6f86bca7..0136e43e 100644
--- a/src/CStructSharp/CStructSyntheticRoots.cs
+++ b/src/CStructSharp/CStructSyntheticRoots.cs
@@ -12,12 +12,12 @@ namespace CStructSharp;
using CStructSharp.Parsing;
using CStructSharp.Syntax;
-///
+///
/// Roots named by a type spelling instead of a declaration: uint32, DWORD, uint64[4],
/// uint16[N], char[], uint8[EOF], entry[2]. Each is compiled once per layout on
/// first use into the same root-field projection a typedef gets, so the readers and writers never see the
/// difference. A declared name always wins over a spelling.
-///
+///
public sealed partial class CStruct
{
private const int PathCacheCapacity = 256;
diff --git a/src/CStructSharp/CStructValueDecoding.cs b/src/CStructSharp/CStructValueDecoding.cs
index e2bea644..671a2d83 100644
--- a/src/CStructSharp/CStructValueDecoding.cs
+++ b/src/CStructSharp/CStructValueDecoding.cs
@@ -9,11 +9,11 @@ namespace CStructSharp;
using CStructSharp.Engine;
using CStructSharp.Values;
-///
+///
/// The decoding rules that depend on the layout's settings, which the compiled engine's reader and its path resolver
/// share: how a bitfield is decoded under the layout's bit order, and the size check before a pointer target is read
/// under its pointer size. The rules that depend only on the field are in .
-///
+///
public sealed partial class CStruct
{
/// The debug records of an ordinary read: one shared empty list, which callers only discard.
diff --git a/src/CStructSharp/CStructValueReader.cs b/src/CStructSharp/CStructValueReader.cs
index 8cb2d646..c506dbe8 100644
--- a/src/CStructSharp/CStructValueReader.cs
+++ b/src/CStructSharp/CStructValueReader.cs
@@ -15,7 +15,7 @@ namespace CStructSharp;
using CStructSharp.Syntax;
using CStructSharp.Values;
-/// Reads natural scalar or composite values and projects them to caller-selected CLR types.
+/// Reads natural scalar or composite values and projects them to caller-selected CLR types.
public sealed partial class CStruct
{
/// Extracts a named value, with a one-value fallback for inline typedef roots.
diff --git a/src/CStructSharp/CStructWriter.StaticPlan.cs b/src/CStructSharp/CStructWriter.StaticPlan.cs
index ba4abc65..791a3e30 100644
--- a/src/CStructSharp/CStructWriter.StaticPlan.cs
+++ b/src/CStructSharp/CStructWriter.StaticPlan.cs
@@ -15,12 +15,12 @@ namespace CStructSharp;
using CStructSharp.Values;
using CStructSharp.Writing;
-///
+///
/// Static write plan: a fully fixed composite is encoded into one block of its exact size - member
/// values looked up once, numbers written with at their compile-time
/// offsets - and the block is written to the destination in one call. The plan is the same operation list the
/// static read plan uses; only its execution differs.
-///
+///
[SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:StaticElementsMustAppearBeforeInstanceElements", Justification = "helpers follow the executor they serve")]
public sealed partial class CStruct
{
diff --git a/src/CStructSharp/CStructWriter.cs b/src/CStructSharp/CStructWriter.cs
index 345f712e..10986853 100644
--- a/src/CStructSharp/CStructWriter.cs
+++ b/src/CStructSharp/CStructWriter.cs
@@ -17,12 +17,12 @@ namespace CStructSharp;
using CStructSharp.Values;
using CStructSharp.Writing;
-///
+///
/// Contains the writing half of : the entry points of Serialize, Write and
/// Update, which settle a write's options, variables, path and program before the compiled engine writes it
/// (), and the primitive and pointer writes the engine delegates to the layout. The value rules
/// every write shares are in .
-///
+///
public sealed partial class CStruct
{
/// The composite a struct root or an inline-struct typedef root writes; false for scalar roots.
diff --git a/src/CStructSharp/Codecs/BoundedTextCodec.Read.cs b/src/CStructSharp/Codecs/BoundedTextCodec.Read.cs
index b0eff658..6d04b25a 100644
--- a/src/CStructSharp/Codecs/BoundedTextCodec.Read.cs
+++ b/src/CStructSharp/Codecs/BoundedTextCodec.Read.cs
@@ -3,7 +3,7 @@ namespace CStructSharp.Codecs;
using System;
using System.Text;
-/// Decodes already buffered text without copying valid input into a temporary byte array.
+/// Decodes already buffered text without copying valid input into a temporary byte array.
internal static partial class BoundedTextCodec
{
/// Decodes the field's complete bytes while retaining the array decoder's exact failures.
diff --git a/src/CStructSharp/Codecs/BoundedTextCodec.Write.cs b/src/CStructSharp/Codecs/BoundedTextCodec.Write.cs
index 5321a286..6c11ac28 100644
--- a/src/CStructSharp/Codecs/BoundedTextCodec.Write.cs
+++ b/src/CStructSharp/Codecs/BoundedTextCodec.Write.cs
@@ -2,7 +2,7 @@ namespace CStructSharp.Codecs;
using System;
-/// Encodes validated bounded text into storage owned by the calling writer.
+/// Encodes validated bounded text into storage owned by the calling writer.
internal static partial class BoundedTextCodec
{
/// Encodes an immutable string after its complete encoding and capacity validation.
diff --git a/src/CStructSharp/Codecs/PrimitiveCodec.IO.cs b/src/CStructSharp/Codecs/PrimitiveCodec.IO.cs
index b2000e51..6ee58a18 100644
--- a/src/CStructSharp/Codecs/PrimitiveCodec.IO.cs
+++ b/src/CStructSharp/Codecs/PrimitiveCodec.IO.cs
@@ -5,7 +5,7 @@ namespace CStructSharp.Codecs;
using System.Runtime.CompilerServices;
using CStructSharp.Generated;
-/// The runtime half of a primitive descriptor: reading and writing one numeric value through a span, via .
+/// The runtime half of a primitive descriptor: reading and writing one numeric value through a span, via .
internal readonly partial record struct PrimitiveCodec
{
// Every one-byte value boxed once: a box cannot be modified, so readers can share them and a parsed byte, sbyte
diff --git a/src/CStructSharp/Codecs/PrimitiveCodecs.IO.cs b/src/CStructSharp/Codecs/PrimitiveCodecs.IO.cs
index 9567c294..e0453143 100644
--- a/src/CStructSharp/Codecs/PrimitiveCodecs.IO.cs
+++ b/src/CStructSharp/Codecs/PrimitiveCodecs.IO.cs
@@ -9,10 +9,10 @@ namespace CStructSharp.Codecs;
using CStructSharp.Generated;
using CStructSharp.Streams;
-///
+///
/// Provides the strict text encodings, terminated-string read/write logic, and other primitive-type-naming
/// support shared by the primitive reader and writer maps that builds for itself.
-///
+///
internal static partial class PrimitiveCodecs
{
///
diff --git a/src/CStructSharp/Compilation/CompiledCompositeType.Matches.cs b/src/CStructSharp/Compilation/CompiledCompositeType.Matches.cs
index 3afdfe73..6599f387 100644
--- a/src/CStructSharp/Compilation/CompiledCompositeType.Matches.cs
+++ b/src/CStructSharp/Compilation/CompiledCompositeType.Matches.cs
@@ -2,7 +2,7 @@ namespace CStructSharp.Compilation;
using System.Threading;
-/// Runtime-only lazy recognition plans; shared compiler metadata contains no runtime reader dependency.
+/// Runtime-only lazy recognition plans; shared compiler metadata contains no runtime reader dependency.
internal sealed partial class CompiledCompositeType
{
private PreparedMatcher? matcher;
diff --git a/src/CStructSharp/Compilation/CompiledCompositeType.Runtime.cs b/src/CStructSharp/Compilation/CompiledCompositeType.Runtime.cs
index c23f9178..63faa946 100644
--- a/src/CStructSharp/Compilation/CompiledCompositeType.Runtime.cs
+++ b/src/CStructSharp/Compilation/CompiledCompositeType.Runtime.cs
@@ -3,7 +3,7 @@ namespace CStructSharp.Compilation;
using System.Threading;
using CStructSharp.Reading;
-/// The runtime half of a compiled composite: the cached span read plan and layout fingerprint.
+/// The runtime half of a compiled composite: the cached span read plan and layout fingerprint.
internal sealed partial class CompiledCompositeType
{
// Stands for "built, and this composite has no static plan", so the cache is a single reference.
diff --git a/src/CStructSharp/Engine/MemoryWriteBuffer.cs b/src/CStructSharp/Engine/MemoryWriteBuffer.cs
index 472296ff..5d56f775 100644
--- a/src/CStructSharp/Engine/MemoryWriteBuffer.cs
+++ b/src/CStructSharp/Engine/MemoryWriteBuffer.cs
@@ -119,7 +119,11 @@ private MemoryWriteBuffer(bool span, byte* region, byte[]? staging, int capacity
///
public override long Position
{
- get => this.position;
+ get
+ {
+ return this.position;
+ }
+
set
{
if (this.span)
diff --git a/src/CStructSharp/Engine/ReadEngine.Debug.cs b/src/CStructSharp/Engine/ReadEngine.Debug.cs
index eb17759b..c6fe18ad 100644
--- a/src/CStructSharp/Engine/ReadEngine.Debug.cs
+++ b/src/CStructSharp/Engine/ReadEngine.Debug.cs
@@ -11,11 +11,11 @@ namespace CStructSharp.Engine;
using CStructSharp.Streams;
using CStructSharp.Values;
-///
+///
/// The debug parse of the compiled engine: the steps only debug programs hold (),
/// which record every value read - its range, path, type spelling and value, in read order - and the layout capture
/// an update compares.
-///
+///
///
///
/// A debug program reads exactly what the ordinary program reads, with the same checks, but every array one
diff --git a/src/CStructSharp/Engine/ReadEngine.Paths.cs b/src/CStructSharp/Engine/ReadEngine.Paths.cs
index 64734583..ef38b09f 100644
--- a/src/CStructSharp/Engine/ReadEngine.Paths.cs
+++ b/src/CStructSharp/Engine/ReadEngine.Paths.cs
@@ -12,13 +12,13 @@ namespace CStructSharp.Engine;
using CStructSharp.Streams;
using CStructSharp.Values;
-///
+///
/// The path operations of the compiled engine: a selected read (ReadValue of a path, and
/// ReadValueWithDebug, which records what it reads), a parse of a nested
/// struct (Parse and the debug parses of a path), ResolveAddress and GetArrayLength. Each
/// resolves its path with the on the operation's cursor and slots, then reads what the
/// path selects: from its exact address, standalone, at the nesting and pointer depth the path reached.
-///
+///
internal static partial class ReadEngine
{
///
diff --git a/src/CStructSharp/Engine/ReadEngine.PlanChecks.cs b/src/CStructSharp/Engine/ReadEngine.PlanChecks.cs
index 997ff41c..9f9d2495 100644
--- a/src/CStructSharp/Engine/ReadEngine.PlanChecks.cs
+++ b/src/CStructSharp/Engine/ReadEngine.PlanChecks.cs
@@ -7,7 +7,7 @@ namespace CStructSharp.Engine;
using CStructSharp.Expressions;
using CStructSharp.Reading;
-/// The checks a static read plan runs between its operations: none, or the root composite's @expect and @supports conditions.
+/// The checks a static read plan runs between its operations: none, or the root composite's @expect and @supports conditions.
internal static partial class ReadEngine
{
/// What a static plan runs after each of its operations.
diff --git a/src/CStructSharp/Engine/ReadEngine.Pointers.cs b/src/CStructSharp/Engine/ReadEngine.Pointers.cs
index 85d45010..8134897a 100644
--- a/src/CStructSharp/Engine/ReadEngine.Pointers.cs
+++ b/src/CStructSharp/Engine/ReadEngine.Pointers.cs
@@ -11,12 +11,12 @@ namespace CStructSharp.Engine;
using CStructSharp.Reading;
using CStructSharp.Values;
-///
+///
/// The pointer reads of the compiled engine, each with a fixed order of checks: the stored address, a deferred or
/// in-place follow, the target's value, and the deferred pointers a struct follows after its last member. The
/// bookkeeping (targets on the active path for cycle detection, the deferred queue) is the pooled
/// .
-///
+///
internal static partial class ReadEngine
{
///
diff --git a/src/CStructSharp/Engine/ReadEngine.Values.cs b/src/CStructSharp/Engine/ReadEngine.Values.cs
index 204a8026..069adbe7 100644
--- a/src/CStructSharp/Engine/ReadEngine.Values.cs
+++ b/src/CStructSharp/Engine/ReadEngine.Values.cs
@@ -13,7 +13,7 @@ namespace CStructSharp.Engine;
using CStructSharp.Reading;
using CStructSharp.Values;
-/// The value reads of the compiled engine: scalars through their codecs, caller codecs through their adapter, and every array shape.
+/// The value reads of the compiled engine: scalars through their codecs, caller codecs through their adapter, and every array shape.
internal static partial class ReadEngine
{
///
diff --git a/src/CStructSharp/Engine/TargetResolver.Counts.cs b/src/CStructSharp/Engine/TargetResolver.Counts.cs
index e19cb723..4764a4ec 100644
--- a/src/CStructSharp/Engine/TargetResolver.Counts.cs
+++ b/src/CStructSharp/Engine/TargetResolver.Counts.cs
@@ -12,7 +12,7 @@ namespace CStructSharp.Engine;
using CStructSharp.Syntax;
using CstructEnum = CStructSharp.Syntax.Enum;
-/// The resolver's counting half: where an element starts, how many elements an array holds, and the size of an element without a fixed size.
+/// The resolver's counting half: where an element starts, how many elements an array holds, and the size of an element without a fixed size.
internal static partial class TargetResolver
{
///
diff --git a/src/CStructSharp/Engine/TargetResolver.Measure.cs b/src/CStructSharp/Engine/TargetResolver.Measure.cs
index e6df276a..4e5f4176 100644
--- a/src/CStructSharp/Engine/TargetResolver.Measure.cs
+++ b/src/CStructSharp/Engine/TargetResolver.Measure.cs
@@ -12,7 +12,7 @@ namespace CStructSharp.Engine;
using CStructSharp.Syntax;
using CstructEnum = CStructSharp.Syntax.Enum;
-/// The resolver's measuring half: where a member, a struct or a composite the walk passes ends, reading only what its size depends on, and the traversal limits a walk into a composite checks first.
+/// The resolver's measuring half: where a member, a struct or a composite the walk passes ends, reading only what its size depends on, and the traversal limits a walk into a composite checks first.
internal static partial class TargetResolver
{
///
diff --git a/src/CStructSharp/Engine/WriteEngine.Unions.cs b/src/CStructSharp/Engine/WriteEngine.Unions.cs
index 814cd643..6420e23a 100644
--- a/src/CStructSharp/Engine/WriteEngine.Unions.cs
+++ b/src/CStructSharp/Engine/WriteEngine.Unions.cs
@@ -9,13 +9,13 @@ namespace CStructSharp.Engine;
using CStructSharp.Values;
using CStructSharp.Writing;
-///
+///
/// The unions of the compiled engine's writer and the end of a struct with bitfields. A union is written in two
/// steps: its whole storage is staged away from the destination - zeroes (or, under update semantics
/// that keep union storage, the union's existing bytes) with the selected member written over them from the union's
/// first byte, with a budget of its own and a copy of the variables - and then written to the destination once, so a
/// member that cannot be written leaves the destination unchanged.
-///
+///
internal static partial class WriteEngine
{
///
diff --git a/src/CStructSharp/Engine/WriteEngine.Values.cs b/src/CStructSharp/Engine/WriteEngine.Values.cs
index 946aa028..1a2d1530 100644
--- a/src/CStructSharp/Engine/WriteEngine.Values.cs
+++ b/src/CStructSharp/Engine/WriteEngine.Values.cs
@@ -18,7 +18,7 @@ namespace CStructSharp.Engine;
using CStructSharp.Values;
using CStructSharp.Writing;
-/// The value encodings of the compiled engine's writer: numbers, codec values, enums, text, arrays, pointers and bitfields.
+/// The value encodings of the compiled engine's writer: numbers, codec values, enums, text, arrays, pointers and bitfields.
internal static partial class WriteEngine
{
///
diff --git a/src/CStructSharp/Generated/ReadCursor.Arrays.cs b/src/CStructSharp/Generated/ReadCursor.Arrays.cs
index a271947e..62d066bf 100644
--- a/src/CStructSharp/Generated/ReadCursor.Arrays.cs
+++ b/src/CStructSharp/Generated/ReadCursor.Arrays.cs
@@ -4,7 +4,7 @@ namespace CStructSharp.Generated;
using CStructSharp.Diagnostics;
using CStructSharp.Reading;
-/// Consuming arrays: element runs charged against the byte budget, element counts to the end or to a terminator, and the element limit.
+/// Consuming arrays: element runs charged against the byte budget, element counts to the end or to a terminator, and the element limit.
public ref partial struct ReadCursor
{
///
diff --git a/src/CStructSharp/Generated/ReadCursor.Buffers.cs b/src/CStructSharp/Generated/ReadCursor.Buffers.cs
index 536b7aa0..32e2f8c7 100644
--- a/src/CStructSharp/Generated/ReadCursor.Buffers.cs
+++ b/src/CStructSharp/Generated/ReadCursor.Buffers.cs
@@ -7,11 +7,11 @@ namespace CStructSharp.Generated;
using System.Threading.Tasks;
using CStructSharp.Streams;
-///
+///
/// The buffered input forms of a generated read: a segmented sequence or a stream is read through a pooled buffer
/// that grows while the span reader needs bytes past it, so the value, failures and offsets are those of the span
/// form over the whole input ().
-///
+///
public ref partial struct ReadCursor
{
///
diff --git a/src/CStructSharp/Generated/ReadCursor.Failures.cs b/src/CStructSharp/Generated/ReadCursor.Failures.cs
index b6a60434..4873d209 100644
--- a/src/CStructSharp/Generated/ReadCursor.Failures.cs
+++ b/src/CStructSharp/Generated/ReadCursor.Failures.cs
@@ -4,7 +4,7 @@ namespace CStructSharp.Generated;
using CStructSharp.Diagnostics;
using CStructSharp.Expressions;
-/// Failures: the runtime's exceptions and texts, with the field, path and position context every read failure carries.
+/// Failures: the runtime's exceptions and texts, with the field, path and position context every read failure carries.
public ref partial struct ReadCursor
{
/// Gets whether the read evaluates no constraint ( is ): a generated constraint check returns before it evaluates a condition.
diff --git a/src/CStructSharp/Generated/ReadCursor.Nesting.cs b/src/CStructSharp/Generated/ReadCursor.Nesting.cs
index bce20b49..3cabfc6d 100644
--- a/src/CStructSharp/Generated/ReadCursor.Nesting.cs
+++ b/src/CStructSharp/Generated/ReadCursor.Nesting.cs
@@ -3,7 +3,7 @@ namespace CStructSharp.Generated;
using System;
using CStructSharp.Diagnostics;
-/// Nesting: entering and leaving composites and unions, and following pointers to their targets with the depth, size and cycle rules.
+/// Nesting: entering and leaving composites and unions, and following pointers to their targets with the depth, size and cycle rules.
public ref partial struct ReadCursor
{
/// Enters a nested struct or union, enforcing MaxNestingDepth.
diff --git a/src/CStructSharp/Generated/ReadCursor.Text.cs b/src/CStructSharp/Generated/ReadCursor.Text.cs
index cceb3b89..4fb8fe88 100644
--- a/src/CStructSharp/Generated/ReadCursor.Text.cs
+++ b/src/CStructSharp/Generated/ReadCursor.Text.cs
@@ -4,7 +4,7 @@ namespace CStructSharp.Generated;
using CStructSharp.Codecs;
using CStructSharp.Diagnostics;
-/// Consuming text: fixed character buffers, encoded text buffers and terminated strings, with the runtime's string limit and failure texts.
+/// Consuming text: fixed character buffers, encoded text buffers and terminated strings, with the runtime's string limit and failure texts.
public ref partial struct ReadCursor
{
/// Consumes an encoded text buffer (utf8[N], ...): the string byte limit, then the bytes, with the runtime's texts.
diff --git a/src/CStructSharp/Generated/ReadCursor.Values.cs b/src/CStructSharp/Generated/ReadCursor.Values.cs
index 8da6e12c..4da5be55 100644
--- a/src/CStructSharp/Generated/ReadCursor.Values.cs
+++ b/src/CStructSharp/Generated/ReadCursor.Values.cs
@@ -4,7 +4,7 @@ namespace CStructSharp.Generated;
using CStructSharp.Codecs;
using CStructSharp.Diagnostics;
-/// Consuming single values: fixed-size composites, byte runs, caller codecs, identifiers and LEB128 integers.
+/// Consuming single values: fixed-size composites, byte runs, caller codecs, identifiers and LEB128 integers.
public ref partial struct ReadCursor
{
///
diff --git a/src/CStructSharp/Generated/ReadCursor.cs b/src/CStructSharp/Generated/ReadCursor.cs
index 7784e32f..40248b38 100644
--- a/src/CStructSharp/Generated/ReadCursor.cs
+++ b/src/CStructSharp/Generated/ReadCursor.cs
@@ -87,7 +87,11 @@ public ReadCursor(ReadOnlySpan source, in ReadLimits limits, string? path
/// Gets or sets the offset of the next byte to read.
public int Position
{
- readonly get => this.position;
+ readonly get
+ {
+ return this.position;
+ }
+
set
{
if (value < 0 || value > this.source.Length)
diff --git a/src/CStructSharp/Generated/WriteCursor.cs b/src/CStructSharp/Generated/WriteCursor.cs
index 6789f16e..42801f35 100644
--- a/src/CStructSharp/Generated/WriteCursor.cs
+++ b/src/CStructSharp/Generated/WriteCursor.cs
@@ -64,7 +64,11 @@ public WriteCursor(Span destination, WriteOptions? options = null, string?
/// Gets or sets the offset of the next byte to write.
public int Position
{
- readonly get => this.position;
+ readonly get
+ {
+ return this.position;
+ }
+
set
{
if (value < 0 || value > this.length)
diff --git a/src/CStructSharp/MappedTypes.Fixed.cs b/src/CStructSharp/MappedTypes.Fixed.cs
index 60e81386..766133de 100644
--- a/src/CStructSharp/MappedTypes.Fixed.cs
+++ b/src/CStructSharp/MappedTypes.Fixed.cs
@@ -4,7 +4,7 @@ namespace CStructSharp;
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
-/// The registry of the direct members of layout-bound mapped classes ().
+/// The registry of the direct members of layout-bound mapped classes ().
public static partial class MappedTypes
{
private static readonly ConcurrentDictionary FixedWriters = new();
diff --git a/src/CStructSharp/Memory/MemoryAccessContext.cs b/src/CStructSharp/Memory/MemoryAccessContext.cs
index b3f7187a..a1eade0e 100644
--- a/src/CStructSharp/Memory/MemoryAccessContext.cs
+++ b/src/CStructSharp/Memory/MemoryAccessContext.cs
@@ -44,7 +44,11 @@ public MemoryAccessContext()
/// The value set is zero or negative.
public long MaxTotalBytes
{
- get => this.maxTotalBytes;
+ get
+ {
+ return this.maxTotalBytes;
+ }
+
init
{
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(value);
@@ -59,7 +63,11 @@ public long MaxTotalBytes
/// The value set is zero or negative.
public int MaxRequests
{
- get => this.maxRequests;
+ get
+ {
+ return this.maxRequests;
+ }
+
init
{
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(value);
@@ -74,7 +82,11 @@ public int MaxRequests
/// The value set is zero or negative.
public int MaxNestingDepth
{
- get => this.maxNestingDepth;
+ get
+ {
+ return this.maxNestingDepth;
+ }
+
init
{
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(value);
@@ -89,7 +101,11 @@ public int MaxNestingDepth
/// The value set is zero or negative.
public int MaxPointerDepth
{
- get => this.maxPointerDepth;
+ get
+ {
+ return this.maxPointerDepth;
+ }
+
init
{
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(value);
diff --git a/src/CStructSharp/Memory/MemoryRegionStream.cs b/src/CStructSharp/Memory/MemoryRegionStream.cs
index 2e46daea..6c76f3c3 100644
--- a/src/CStructSharp/Memory/MemoryRegionStream.cs
+++ b/src/CStructSharp/Memory/MemoryRegionStream.cs
@@ -48,7 +48,11 @@ internal MemoryRegionStream(MemoryRegion region, MemoryAccessContext context)
/// Gets or sets the local position, from zero (the region's start) to the region length (end of file).
public override long Position
{
- get => this.position;
+ get
+ {
+ return this.position;
+ }
+
set
{
ObjectDisposedException.ThrowIf(this.disposed, this);
diff --git a/src/CStructSharp/Memory/MemoryScalarCodec.cs b/src/CStructSharp/Memory/MemoryScalarCodec.cs
index 04052630..ab4dd5a2 100644
--- a/src/CStructSharp/Memory/MemoryScalarCodec.cs
+++ b/src/CStructSharp/Memory/MemoryScalarCodec.cs
@@ -97,8 +97,9 @@ internal Type ResultType(bool signedSlice)
return typeof(Values.EnumValueResult);
}
- return this.bitWidth > 0 ? signedSlice ? typeof(long) : this.bitWidth < 32 ? typeof(int) : typeof(ulong)
- : direct is not null ? FieldAccessor
+/// How pointer values map to stream positions.
+/// Whether non-null pointers are followed while reading.
+/// The most pointers followed in one chain.
+/// The largest decoded size of one pointer target in bytes; when unrestricted.
+/// The largest element count of one array.
+/// The largest encoded length in bytes of one terminated string, terminator included.
+/// The total byte budget of the operation.
+/// The deepest struct and union nesting the read enters.
+/// The signed base position added to relative pointer offsets.
+/// Whether fixed-capacity text drops its trailing NUL padding.
+/// The token observed at composite, pointer, array-block and string-chunk boundaries.
+/// Which fast paths the read may take before the compiled engine.
+/// The rarely set members (offset base, violation collection, buffered-input continuation); for an ordinary read.
+/// Whether invalid encoded text reads as U+FFFD instead of failing the read.
internal readonly record struct ReadOperationSettings(
PointerAddressingMode AddressingMode,
bool DereferencePointers,
@@ -39,7 +53,11 @@ internal readonly record struct ReadOperationSettings(
/// Gets the largest decoded size of one pointer target in bytes, or null when target sizes are unrestricted.
public long? MaxPointerTargetBytes
{
- get => this.hasMaxPointerTargetBytes ? this.maxPointerTargetBytes : null;
+ get
+ {
+ return this.hasMaxPointerTargetBytes ? this.maxPointerTargetBytes : null;
+ }
+
init
{
this.hasMaxPointerTargetBytes = value.HasValue;
@@ -67,24 +85,6 @@ public long? MaxPointerTargetBytes
!this.CancellationToken.IsCancellationRequested && this.MaxPointerDepth >= 0 && this.maxPointerTargetBytes >= 0 &&
this.MaxArrayElements >= 0 && this.MaxStringBytes >= 0 && this.MaxTotalBytesRead >= 0 && this.MaxNestingDepth > 0;
- ///
- /// Returns whether these limits admit a read the compiled engine would complete at structure depth
- /// : within the byte budget, the read's structs within the
- /// nesting limit, and its longest array within the element limit.
- ///
- /// The bytes the read consumes.
- /// The structure depth the read starts at (0 for a root).
- /// The struct levels the read adds.
- /// The largest element count among the read's arrays.
- /// Whether the read stays within every limit.
- public bool Covers(long bytes, int structureDepth, int nestingDepth, int arrayCount)
- => bytes <= this.MaxTotalBytesRead && structureDepth + nestingDepth <= this.MaxNestingDepth && arrayCount <= this.MaxArrayElements;
-
- /// Returns whether these limits admit running as a root read.
- /// The static read plan.
- /// Whether the plan's bytes, nesting and arrays stay within the limits.
- public bool CoversPlan(StaticReadPlan plan) => plan.Size <= this.MaxTotalBytesRead && PlanFits(plan, 0, this.MaxNestingDepth, this.MaxArrayElements);
-
///
/// Returns whether a static plan's structs and arrays fit the nesting and element limits when it starts at
/// : the check a root read () and the engine's nested reads
@@ -232,4 +232,22 @@ public static void ValidateSettings(in ReadOperationSettings options)
throw new ArgumentOutOfRangeException(nameof(options), "Maximum nesting depth must be greater than zero.");
}
}
+
+ ///
+ /// Returns whether these limits admit a read the compiled engine would complete at structure depth
+ /// : within the byte budget, the read's structs within the
+ /// nesting limit, and its longest array within the element limit.
+ ///
+ /// The bytes the read consumes.
+ /// The structure depth the read starts at (0 for a root).
+ /// The struct levels the read adds.
+ /// The largest element count among the read's arrays.
+ /// Whether the read stays within every limit.
+ public bool Covers(long bytes, int structureDepth, int nestingDepth, int arrayCount)
+ => bytes <= this.MaxTotalBytesRead && structureDepth + nestingDepth <= this.MaxNestingDepth && arrayCount <= this.MaxArrayElements;
+
+ /// Returns whether these limits admit running as a root read.
+ /// The static read plan.
+ /// Whether the plan's bytes, nesting and arrays stay within the limits.
+ public bool CoversPlan(StaticReadPlan plan) => plan.Size <= this.MaxTotalBytesRead && PlanFits(plan, 0, this.MaxNestingDepth, this.MaxArrayElements);
}
diff --git a/src/CStructSharp/Reading/RecordRoot.cs b/src/CStructSharp/Reading/RecordRoot.cs
index 26fd5e90..ef0773a6 100644
--- a/src/CStructSharp/Reading/RecordRoot.cs
+++ b/src/CStructSharp/Reading/RecordRoot.cs
@@ -1,4 +1,6 @@
namespace CStructSharp.Reading;
/// The struct a record sequence is made of: its declaration name and its fixed size, when it has one under the operation's variables.
+/// The struct's declaration name.
+/// The struct's size in bytes when every record has the same size; when each record's size depends on its contents.
internal readonly record struct RecordRoot(string Name, int? Size);
diff --git a/src/CStructSharp/Streams/BufferWriterStream.cs b/src/CStructSharp/Streams/BufferWriterStream.cs
index 032d1809..c92e0259 100644
--- a/src/CStructSharp/Streams/BufferWriterStream.cs
+++ b/src/CStructSharp/Streams/BufferWriterStream.cs
@@ -81,30 +81,30 @@ public override void Flush()
}
/// Reads bytes retained in the active window for bitfield merging.
- /// The array that receives the bytes.
- /// The index in where the first byte is stored.
+ /// The array that receives the bytes.
+ /// The index in where the first byte is stored.
/// The maximum number of bytes to read.
/// The number of bytes copied, or 0 at or past the end of the active window.
- public override int Read(byte[] destination, int offset, int count)
+ public override int Read(byte[] buffer, int offset, int count)
{
- StreamArgumentValidation.ValidateRange(destination, offset, count, nameof(destination));
- return this.Read(destination.AsSpan(offset, count));
+ StreamArgumentValidation.ValidateRange(buffer, offset, count, nameof(buffer));
+ return this.Read(buffer.AsSpan(offset, count));
}
/// Reads bytes retained in the active window for bitfield merging.
- /// The span to fill; at most its length in bytes is copied.
+ /// The span to fill; at most its length in bytes is copied.
/// The number of bytes copied, or 0 at or past the end of the active window.
/// was already called.
- public override int Read(Span destination)
+ public override int Read(Span buffer)
{
this.EnsureActive();
- int count = Math.Min(destination.Length, this.windowLength - this.windowPosition);
+ int count = Math.Min(buffer.Length, this.windowLength - this.windowPosition);
if (count <= 0)
{
return 0;
}
- this.window.Span.Slice(this.windowPosition, count).CopyTo(destination);
+ this.window.Span.Slice(this.windowPosition, count).CopyTo(buffer);
this.windowPosition += count;
return count;
}
@@ -185,34 +185,34 @@ public override void SetLength(long value)
}
/// Appends or rewrites bytes in the active uncommitted window.
- /// The array holding the bytes to write.
- /// The index in of the first byte to write.
+ /// The array holding the bytes to write.
+ /// The index in of the first byte to write.
/// The number of bytes to write.
- public override void Write(byte[] source, int offset, int count)
+ public override void Write(byte[] buffer, int offset, int count)
{
- StreamArgumentValidation.ValidateRange(source, offset, count, nameof(source));
- this.Write(source.AsSpan(offset, count));
+ StreamArgumentValidation.ValidateRange(buffer, offset, count, nameof(buffer));
+ this.Write(buffer.AsSpan(offset, count));
}
/// Appends or rewrites bytes in the active uncommitted window.
- ///
+ ///
/// The bytes to copy at the current position; a gap left by seeking forward is zero-filled first.
///
/// was already called.
///
/// The bytes would overwrite part of the window and then cross into output that must be committed first.
///
- public override void Write(ReadOnlySpan source)
+ public override void Write(ReadOnlySpan buffer)
{
this.EnsureActive();
- this.EnsureWritableRange(source.Length);
+ this.EnsureWritableRange(buffer.Length);
if (this.windowPosition > this.windowLength)
{
this.window.Span.Slice(this.windowLength, this.windowPosition - this.windowLength).Clear();
}
- source.CopyTo(this.window.Span.Slice(this.windowPosition, source.Length));
- this.windowPosition += source.Length;
+ buffer.CopyTo(this.window.Span.Slice(this.windowPosition, buffer.Length));
+ this.windowPosition += buffer.Length;
this.windowLength = Math.Max(this.windowLength, this.windowPosition);
}
diff --git a/src/CStructSharp/Streams/FixedBufferStream.cs b/src/CStructSharp/Streams/FixedBufferStream.cs
index aefabc9e..ec0e14b8 100644
--- a/src/CStructSharp/Streams/FixedBufferStream.cs
+++ b/src/CStructSharp/Streams/FixedBufferStream.cs
@@ -10,7 +10,7 @@ namespace CStructSharp.Streams;
///
internal sealed unsafe class FixedBufferStream : Stream
{
- private readonly byte* buffer;
+ private readonly byte* regionStart;
private readonly int capacity;
private readonly bool writable;
private long length;
@@ -42,7 +42,7 @@ public FixedBufferStream(byte* buffer, int capacity, bool writable, bool initial
throw new ArgumentOutOfRangeException(nameof(capacity));
}
- this.buffer = buffer;
+ this.regionStart = buffer;
this.capacity = capacity;
this.writable = writable;
this.length = initialized ? capacity : 0;
@@ -67,7 +67,11 @@ public FixedBufferStream(byte* buffer, int capacity, bool writable, bool initial
/// The value is negative or past the capacity.
public override long Position
{
- get => this.position;
+ get
+ {
+ return this.position;
+ }
+
set
{
if (value < 0 || value > this.capacity)
@@ -95,34 +99,34 @@ public override void Flush()
///
internal bool TryGetReadOnlyRegion(out byte* region, out long length)
{
- region = this.buffer;
+ region = this.regionStart;
length = this.length;
return !this.writable;
}
/// Reads initialized bytes from the current region position.
- /// The array that receives the bytes.
- /// The index in where the first byte is stored.
+ /// The array that receives the bytes.
+ /// The index in where the first byte is stored.
/// The maximum number of bytes to read.
/// The number of bytes copied, or 0 at or past the initialized length.
- public override int Read(byte[] destination, int offset, int count)
+ public override int Read(byte[] buffer, int offset, int count)
{
- StreamArgumentValidation.ValidateRange(destination, offset, count, nameof(destination));
- return this.Read(destination.AsSpan(offset, count));
+ StreamArgumentValidation.ValidateRange(buffer, offset, count, nameof(buffer));
+ return this.Read(buffer.AsSpan(offset, count));
}
/// Reads initialized bytes from the current region position.
- /// The span to fill; at most its length in bytes is copied.
+ /// The span to fill; at most its length in bytes is copied.
/// The number of bytes copied, or 0 at or past the initialized length.
- public override int Read(Span destination)
+ public override int Read(Span buffer)
{
- int count = (int)Math.Min(destination.Length, Math.Max(0, this.length - this.position));
+ int count = (int)Math.Min(buffer.Length, Math.Max(0, this.length - this.position));
if (count == 0)
{
return 0;
}
- new ReadOnlySpan(this.buffer + (int)this.position, count).CopyTo(destination);
+ new ReadOnlySpan(this.regionStart + (int)this.position, count).CopyTo(buffer);
this.position += count;
return count;
}
@@ -177,7 +181,7 @@ public override void SetLength(long value)
if (value > this.length)
{
- new Span(this.buffer + (int)this.length, (int)(value - this.length)).Clear();
+ new Span(this.regionStart + (int)this.length, (int)(value - this.length)).Clear();
}
this.length = value;
@@ -188,36 +192,36 @@ public override void SetLength(long value)
}
/// Writes into caller storage and extends the initialized prefix.
- /// The array holding the bytes to write.
- /// The index in of the first byte to write.
+ /// The array holding the bytes to write.
+ /// The index in of the first byte to write.
/// The number of bytes to write.
- public override void Write(byte[] source, int offset, int count)
+ public override void Write(byte[] buffer, int offset, int count)
{
- StreamArgumentValidation.ValidateRange(source, offset, count, nameof(source));
- this.Write(source.AsSpan(offset, count));
+ StreamArgumentValidation.ValidateRange(buffer, offset, count, nameof(buffer));
+ this.Write(buffer.AsSpan(offset, count));
}
/// Writes into caller storage and extends the initialized prefix.
- ///
+ ///
/// The bytes to copy at the current position; a gap left by seeking past the length is zero-filled first.
///
/// The region is read-only.
/// The bytes would run past the region's capacity.
- public override void Write(ReadOnlySpan source)
+ public override void Write(ReadOnlySpan buffer)
{
this.EnsureWritable();
- if (source.Length > this.capacity - this.position)
+ if (buffer.Length > this.capacity - this.position)
{
throw new CStructWriteException(WriteFailures.DestinationCapacity);
}
if (this.position > this.length)
{
- new Span(this.buffer + (int)this.length, (int)(this.position - this.length)).Clear();
+ new Span(this.regionStart + (int)this.length, (int)(this.position - this.length)).Clear();
}
- source.CopyTo(new Span(this.buffer + (int)this.position, source.Length));
- this.position += source.Length;
+ buffer.CopyTo(new Span(this.regionStart + (int)this.position, buffer.Length));
+ this.position += buffer.Length;
this.length = Math.Max(this.length, this.position);
}
diff --git a/src/CStructSharp/Streams/SparseUpdateStream.cs b/src/CStructSharp/Streams/SparseUpdateStream.cs
index 578aeb54..e1043233 100644
--- a/src/CStructSharp/Streams/SparseUpdateStream.cs
+++ b/src/CStructSharp/Streams/SparseUpdateStream.cs
@@ -61,7 +61,11 @@ public SparseUpdateStream(Stream baseline, long initialPosition, ArrayPool
/// The value set is negative.
public override long Position
{
- get => this.position;
+ get
+ {
+ return this.position;
+ }
+
set
{
if (value < 0)
diff --git a/src/CStructSharp/Values/StructValue.cs b/src/CStructSharp/Values/StructValue.cs
index 9a25792a..7a34ae4e 100644
--- a/src/CStructSharp/Values/StructValue.cs
+++ b/src/CStructSharp/Values/StructValue.cs
@@ -98,13 +98,13 @@ public object? this[string name]
}
/// Returns the member value, or when the member is absent.
- /// The member name, case-sensitive.
+ /// The member name, case-sensitive.
/// The member value when present; otherwise .
/// when the member is present.
- public bool TryGetValue(string name, out object? value)
+ public bool TryGetValue(string key, out object? value)
{
- ArgumentNullException.ThrowIfNull(name);
- if (this.shape.TryGetIndex(name, out int index))
+ ArgumentNullException.ThrowIfNull(key);
+ if (this.shape.TryGetIndex(key, out int index))
{
object? slot = this.slots[index];
if (!ReferenceEquals(slot, Unset))
@@ -119,7 +119,7 @@ public bool TryGetValue(string name, out object? value)
if (this.extra is not null)
{
- return this.extra.TryGetValue(name, out value);
+ return this.extra.TryGetValue(key, out value);
}
value = null;
@@ -223,47 +223,47 @@ public T GetOrDefault(string path, T fallback)
=> this.TryGet(path, out T? value, out _) ? value! : fallback;
/// Returns whether a member is present.
- /// The member name, case-sensitive.
+ /// The member name, case-sensitive.
/// when the member is present.
- public bool ContainsKey(string name)
+ public bool ContainsKey(string key)
{
- return this.TryGetValue(name, out _);
+ return this.TryGetValue(key, out _);
}
/// Adds a member; throws when it is already present.
- /// The member name, case-sensitive.
+ /// The member name, case-sensitive.
/// The member value.
- public void Add(string name, object? value)
+ public void Add(string key, object? value)
{
- if (this.ContainsKey(name))
+ if (this.ContainsKey(key))
{
- throw new ArgumentException($"The parsed struct already has a member '{name}'.", nameof(name));
+ throw new ArgumentException($"The parsed struct already has a member '{key}'.", nameof(key));
}
- this.Set(name, value);
+ this.Set(key, value);
}
/// Removes a member; returns whether it was present.
- /// The member name, case-sensitive.
+ /// The member name, case-sensitive.
/// when the member was present and has been removed.
- public bool Remove(string name)
+ public bool Remove(string key)
{
- ArgumentNullException.ThrowIfNull(name);
+ ArgumentNullException.ThrowIfNull(key);
bool removed;
- if (this.shape.TryGetIndex(name, out int index))
+ if (this.shape.TryGetIndex(key, out int index))
{
removed = !ReferenceEquals(this.slots[index], Unset);
this.slots[index] = Unset;
}
else
{
- removed = this.extra?.Remove(name) ?? false;
+ removed = this.extra?.Remove(key) ?? false;
}
if (removed)
{
this.count--;
- this.insertionOrder?.Remove(name);
+ this.insertionOrder?.Remove(key);
}
return removed;
diff --git a/src/CStructSharp/Values/ValuePath.cs b/src/CStructSharp/Values/ValuePath.cs
index e8f735de..9352cf86 100644
--- a/src/CStructSharp/Values/ValuePath.cs
+++ b/src/CStructSharp/Values/ValuePath.cs
@@ -353,12 +353,15 @@ private static string Describe(IEnumerable names)
return string.Join(", ", names);
}
+ /// Names a container type the way a path failure message describes it.
+ /// The runtime type of the value the path reached.
+ /// struct, union, pointer, enum value, or the type name otherwise.
private static string Describe(Type type)
{
- return type == typeof(StructValue) ? "struct"
- : type == typeof(UnionValue) ? "union"
- : type == typeof(Pointer) ? "pointer"
- : type == typeof(EnumValueResult) ? "enum value"
- : type.Name;
+ return type == typeof(StructValue) ? "struct" :
+ type == typeof(UnionValue) ? "union" :
+ type == typeof(Pointer) ? "pointer" :
+ type == typeof(EnumValueResult) ? "enum value" :
+ type.Name;
}
}
diff --git a/src/CStructSharp/Writing/NoStaticWriteCaptures.cs b/src/CStructSharp/Writing/NoStaticWriteCaptures.cs
index 792ae71e..93a59267 100644
--- a/src/CStructSharp/Writing/NoStaticWriteCaptures.cs
+++ b/src/CStructSharp/Writing/NoStaticWriteCaptures.cs
@@ -11,7 +11,11 @@ namespace CStructSharp.Writing;
/// Gets ; setting it does nothing.
public string? QualifiedPrefix
{
- get => null;
+ get
+ {
+ return null;
+ }
+
set
{
// No later field reads a qualified name, so the prefix is not kept.
diff --git a/tests/CStructSharp.Generated.Parity/CStructSharp.Generated.Parity.csproj b/tests/CStructSharp.Generated.Parity/CStructSharp.Generated.Parity.csproj
index d83709bf..17cee090 100644
--- a/tests/CStructSharp.Generated.Parity/CStructSharp.Generated.Parity.csproj
+++ b/tests/CStructSharp.Generated.Parity/CStructSharp.Generated.Parity.csproj
@@ -12,8 +12,8 @@
-
-
+
+
diff --git a/tests/CStructSharp.Generated.Parity/StreamFailureTests.cs b/tests/CStructSharp.Generated.Parity/StreamFailureTests.cs
index 2814acce..0ca6d4e0 100644
--- a/tests/CStructSharp.Generated.Parity/StreamFailureTests.cs
+++ b/tests/CStructSharp.Generated.Parity/StreamFailureTests.cs
@@ -96,7 +96,11 @@ public PartialFailureStream(bool cancel, bool failRestore)
/// Gets the cursor or restores it, optionally failing to model a broken underlying source.
public override long Position
{
- get => this.position;
+ get
+ {
+ return this.position;
+ }
+
set
{
this.RestoreAttempted = true;
diff --git a/tests/CStructSharp.Generators.Modern.Tests/CStructSharp.Generators.Modern.Tests.csproj b/tests/CStructSharp.Generators.Modern.Tests/CStructSharp.Generators.Modern.Tests.csproj
index ca2a306e..3880271a 100644
--- a/tests/CStructSharp.Generators.Modern.Tests/CStructSharp.Generators.Modern.Tests.csproj
+++ b/tests/CStructSharp.Generators.Modern.Tests/CStructSharp.Generators.Modern.Tests.csproj
@@ -7,8 +7,8 @@
$(DefineConstants);MODERN_ROSLYN
-
-
+
+
diff --git a/tests/CStructSharp.Generators.Tests/AnalyzerTests.cs b/tests/CStructSharp.Generators.Tests/AnalyzerTests.cs
index b592ae87..a0967983 100644
--- a/tests/CStructSharp.Generators.Tests/AnalyzerTests.cs
+++ b/tests/CStructSharp.Generators.Tests/AnalyzerTests.cs
@@ -1,7 +1,7 @@
-extern alias Generators;
-
namespace CStructSharp.Generators.Tests;
+extern alias Generators;
+
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
diff --git a/tests/CStructSharp.Generators.Tests/BenchmarkFixture.cs b/tests/CStructSharp.Generators.Tests/BenchmarkFixture.cs
index fb2a8513..ca3a3186 100644
--- a/tests/CStructSharp.Generators.Tests/BenchmarkFixture.cs
+++ b/tests/CStructSharp.Generators.Tests/BenchmarkFixture.cs
@@ -4,6 +4,16 @@ namespace CStructSharp.Generators.Tests;
using CStructSharp;
/// One benchmark fixture case with its bytes and options.
+/// The fixture's identifier.
+/// The layout text.
+/// The struct the fixture parses.
+/// The pointer width in bytes.
+/// Whether the portable composite-alignment rules apply.
+/// Whether neutral values are little-endian.
+/// The input bytes.
+/// The layout variables passed to the read.
+/// The read options, or for the defaults.
+/// The failure message the read must report, or when it succeeds.
internal sealed record BenchmarkFixture(
string Id,
string Definition,
diff --git a/tests/CStructSharp.Generators.Tests/CStructSharp.Generators.Tests.csproj b/tests/CStructSharp.Generators.Tests/CStructSharp.Generators.Tests.csproj
index 1511f9d4..c3f4f370 100644
--- a/tests/CStructSharp.Generators.Tests/CStructSharp.Generators.Tests.csproj
+++ b/tests/CStructSharp.Generators.Tests/CStructSharp.Generators.Tests.csproj
@@ -8,8 +8,8 @@
-
-
+
+
diff --git a/tests/CStructSharp.Generators.Tests/ConstraintAnalyzerTests.cs b/tests/CStructSharp.Generators.Tests/ConstraintAnalyzerTests.cs
index f0b3f403..91c6683d 100644
--- a/tests/CStructSharp.Generators.Tests/ConstraintAnalyzerTests.cs
+++ b/tests/CStructSharp.Generators.Tests/ConstraintAnalyzerTests.cs
@@ -1,7 +1,7 @@
-extern alias Generators;
-
namespace CStructSharp.Generators.Tests;
+extern alias Generators;
+
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
diff --git a/tests/CStructSharp.Generators.Tests/GeneratorFrameTests.cs b/tests/CStructSharp.Generators.Tests/GeneratorFrameTests.cs
index c82df906..36d2c5a3 100644
--- a/tests/CStructSharp.Generators.Tests/GeneratorFrameTests.cs
+++ b/tests/CStructSharp.Generators.Tests/GeneratorFrameTests.cs
@@ -1,7 +1,7 @@
-extern alias Generators;
-
namespace CStructSharp.Generators.Tests;
+extern alias Generators;
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/tests/CStructSharp.Generators.Tests/GeneratorRunner.cs b/tests/CStructSharp.Generators.Tests/GeneratorRunner.cs
index 721ec73b..e88dea66 100644
--- a/tests/CStructSharp.Generators.Tests/GeneratorRunner.cs
+++ b/tests/CStructSharp.Generators.Tests/GeneratorRunner.cs
@@ -1,7 +1,7 @@
-extern alias Generators;
-
namespace CStructSharp.Generators.Tests;
+extern alias Generators;
+
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
diff --git a/tests/CStructSharp.Generators.Tests/LayoutUsageAnalyzerTests.cs b/tests/CStructSharp.Generators.Tests/LayoutUsageAnalyzerTests.cs
index cc89d0b4..10aca20e 100644
--- a/tests/CStructSharp.Generators.Tests/LayoutUsageAnalyzerTests.cs
+++ b/tests/CStructSharp.Generators.Tests/LayoutUsageAnalyzerTests.cs
@@ -1,7 +1,7 @@
-extern alias Generators;
-
namespace CStructSharp.Generators.Tests;
+extern alias Generators;
+
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
diff --git a/tests/CStructSharp.Generators.Tests/ManualFixture.cs b/tests/CStructSharp.Generators.Tests/ManualFixture.cs
index 0c2788df..952a6b7e 100644
--- a/tests/CStructSharp.Generators.Tests/ManualFixture.cs
+++ b/tests/CStructSharp.Generators.Tests/ManualFixture.cs
@@ -3,6 +3,17 @@ namespace CStructSharp.Generators.Tests;
using System.Collections.Generic;
/// One valid fixture of the language contract and the options it was recorded with.
+/// The fixture pair's identifier.
+/// The layout text.
+/// The struct the fixture parses.
+/// The pointer width in bytes.
+/// Whether the portable composite-alignment rules apply.
+/// Whether neutral values are little-endian.
+/// The input bytes as hexadecimal text, or when the fixture has none.
+/// The layout variables passed to the read.
+/// The bitfield allocation option, or for the default.
+/// The width of C long in bits; 0 for the library default.
+/// The storage type of an enum declared without one, or for the default.
internal sealed record ManualFixture(
string Id,
string Definition,
diff --git a/tests/CStructSharpTests/Api/CancellationTests.cs b/tests/CStructSharpTests/Api/CancellationTests.cs
index 9dd72432..d179dea2 100644
--- a/tests/CStructSharpTests/Api/CancellationTests.cs
+++ b/tests/CStructSharpTests/Api/CancellationTests.cs
@@ -223,7 +223,8 @@ private static IEnumerable CancelAfterValue(CancellationTokenSource canc
}
/// A one-byte tag codec that cancels the shared token the first time it is called.
- private sealed class CancellingTag(CancellationTokenSource source) : ICustomCodec
+ /// The source the codec cancels when it reads or writes.
+ private sealed class CancellingTag(CancellationTokenSource cancellation) : ICustomCodec
{
public string Name => "tag";
@@ -236,15 +237,15 @@ private sealed class CancellingTag(CancellationTokenSource source) : ICustomCode
public int Writes { get; set; }
/// Counts the read, cancels the token, then decodes one byte.
- /// The available bytes.
+ /// The available bytes.
/// Receives the decoded value.
/// Receives the bytes the value used.
/// Whether the value was decoded or needs more bytes.
- public OperationStatus Read(ReadOnlySpan source1, out object? value, out int bytesConsumed)
+ public OperationStatus Read(ReadOnlySpan source, out object? value, out int bytesConsumed)
{
this.Reads++;
- source.Cancel();
- value = (ulong)source1[0];
+ cancellation.Cancel();
+ value = (ulong)source[0];
bytesConsumed = 1;
return OperationStatus.Done;
}
@@ -257,7 +258,7 @@ public OperationStatus Read(ReadOnlySpan source1, out object? value, out i
public OperationStatus Write(Span destination, object value, out int bytesWritten)
{
this.Writes++;
- source.Cancel();
+ cancellation.Cancel();
destination[0] = (byte)Convert.ToUInt64(value, CultureInfo.InvariantCulture);
bytesWritten = 1;
return OperationStatus.Done;
diff --git a/tests/CStructSharpTests/Arrays/CompositeArrayTests.cs b/tests/CStructSharpTests/Arrays/CompositeArrayTests.cs
index 073e2a3a..c45bebbf 100644
--- a/tests/CStructSharpTests/Arrays/CompositeArrayTests.cs
+++ b/tests/CStructSharpTests/Arrays/CompositeArrayTests.cs
@@ -151,14 +151,14 @@ private sealed class LargeFixedCodec : ICustomCodec
/// Consumes a complete fixed block or reports that the supplied input is too short.
/// The borrowed input bytes.
/// A zero marker on success, otherwise null.
- /// The declared extent on success, otherwise zero.
+ /// The declared extent on success, otherwise zero.
/// Done only when the whole fixed block is present.
- public OperationStatus Read(ReadOnlySpan source, out object? value, out int bytesRead)
+ public OperationStatus Read(ReadOnlySpan source, out object? value, out int bytesConsumed)
{
this.ReadCalls++;
bool complete = source.Length >= this.FixedSize!.Value;
value = complete ? 0 : null;
- bytesRead = complete ? this.FixedSize.Value : 0;
+ bytesConsumed = complete ? this.FixedSize.Value : 0;
return complete ? OperationStatus.Done : OperationStatus.NeedMoreData;
}
diff --git a/tests/CStructSharpTests/Arrays/TerminatedRecordExtentOverflowTests.cs b/tests/CStructSharpTests/Arrays/TerminatedRecordExtentOverflowTests.cs
index ebceafc4..b1f0b34c 100644
--- a/tests/CStructSharpTests/Arrays/TerminatedRecordExtentOverflowTests.cs
+++ b/tests/CStructSharpTests/Arrays/TerminatedRecordExtentOverflowTests.cs
@@ -55,7 +55,11 @@ public HighOriginSource(byte[] bytes)
/// The requested position precedes the mapped buffer.
public override long Position
{
- get => checked(Origin + base.Position);
+ get
+ {
+ return checked(Origin + base.Position);
+ }
+
set
{
ArgumentOutOfRangeException.ThrowIfLessThan(value, Origin);
diff --git a/tests/CStructSharpTests/Async/AsyncStreamBufferTests.cs b/tests/CStructSharpTests/Async/AsyncStreamBufferTests.cs
index a474a2e1..a3277b4c 100644
--- a/tests/CStructSharpTests/Async/AsyncStreamBufferTests.cs
+++ b/tests/CStructSharpTests/Async/AsyncStreamBufferTests.cs
@@ -159,6 +159,7 @@ public void Link_JoinsTheTwoTokens()
}
/// A forward-only stream over an array that can fail after a number of bytes.
+ /// The bytes the stream reads, from the first; not copied.
internal sealed class NonSeekableStream(byte[] bytes) : Stream
{
private int position;
diff --git a/tests/CStructSharpTests/Async/AsyncWriteBoundaryTests.cs b/tests/CStructSharpTests/Async/AsyncWriteBoundaryTests.cs
index 18604311..6ed1ee27 100644
--- a/tests/CStructSharpTests/Async/AsyncWriteBoundaryTests.cs
+++ b/tests/CStructSharpTests/Async/AsyncWriteBoundaryTests.cs
@@ -332,7 +332,11 @@ public FailingRestorationStream(bool failFlush)
public override long Position
{
- get => base.Position;
+ get
+ {
+ return base.Position;
+ }
+
set
{
if (this.refusePosition)
diff --git a/tests/CStructSharpTests/CStructSharpTests.csproj b/tests/CStructSharpTests/CStructSharpTests.csproj
index 0c2ed74f..512ce9bf 100644
--- a/tests/CStructSharpTests/CStructSharpTests.csproj
+++ b/tests/CStructSharpTests/CStructSharpTests.csproj
@@ -8,8 +8,8 @@
-
-
+
+ allruntime; build; native; contentfiles; analyzers
diff --git a/tests/CStructSharpTests/Engine/Golden/EngineCorpusTests.txt b/tests/CStructSharpTests/Engine/Golden/EngineCorpusTests.txt
index 18f722ff..9dd18460 100644
--- a/tests/CStructSharpTests/Engine/Golden/EngineCorpusTests.txt
+++ b/tests/CStructSharpTests/Engine/Golden/EngineCorpusTests.txt
@@ -1969,6 +1969,10 @@
@hash cf1e3a7f93cb2c3a64d0b01fdc39f26a746589ea5739a5b5819649dd25551a80 17
CStructReadLimitException 17
+@test InspectorSchema_ReadsAndWritesOnEverySourceAndPath("detected-caf")
+@hash 90e636c867a701ec3d6bbb87f8a38f67caf8cdb0c3afce30eb5440096f935dde 39
+ ok 39
+
@test InspectorSchema_ReadsAndWritesOnEverySourceAndPath("detected-cfb")
@hash 63063c3f3f48f3da99a0c514ee2110b45d0a6b55766aced531c5ede8f7119410 17
CStructReadException 17
@@ -2013,6 +2017,10 @@
@hash b877f24728282bd394206c228127715bb8fe0abda550660182fa6b6d11cab466 39
ok 39
+@test InspectorSchema_ReadsAndWritesOnEverySourceAndPath("detected-dff")
+@hash 8f6694ccd4c6bf488fe70f7194332f3727dca0a53627b38200e71c6d2e3fdd00 39
+ ok 39
+
@test InspectorSchema_ReadsAndWritesOnEverySourceAndPath("detected-dmg")
@hash 742e8198b5f731e5f5d600c90576acc5add4c6a9e7174248062710a50b156dbb 35
ok 35
diff --git a/tests/CStructSharpTests/Engine/Golden/ExpressionDifferentialTests.txt b/tests/CStructSharpTests/Engine/Golden/ExpressionDifferentialTests.txt
index e8c34f48..7471f16a 100644
--- a/tests/CStructSharpTests/Engine/Golden/ExpressionDifferentialTests.txt
+++ b/tests/CStructSharpTests/Engine/Golden/ExpressionDifferentialTests.txt
@@ -188,6 +188,8 @@
ok 12
@hash 5c5fa412739787556f82d8185444110c97dc5eca05ed73fc3e3f064a04fa962b 833 detected-cab
ok 496, CStructLayoutException 14, CStructReadException 323
+@hash 7edcf9da16b06cfd779507a66556bf8704eaf0ad3330be25c72e3c4a74332ab2 9 detected-caf
+ ok 9
@hash 66269ebda564e0dbc49503079dc706ec26504be7022c2a72c82388dce71233cf 9 detected-cfb
ok 9
@hash e0cd8aae41a4c01c885679a79ff18989595ba810d6e8060d347b38526cc8502d 3 detected-chm
@@ -208,6 +210,8 @@
ok 8132, CStructLayoutException 234, CStructReadException 5314
@hash 4ed76cf62f1d4f787e3db91675953e42db05a43b13dcb7ddbbe7c09209da0d48 24 detected-deb
ok 24
+@hash 7edcf9da16b06cfd779507a66556bf8704eaf0ad3330be25c72e3c4a74332ab2 9 detected-dff
+ ok 9
@hash de1f838a2886c4f19c74bde7ced3ccbf4bed9e41f1794644e1628966bf961f94 568 detected-dng
ok 356, CStructLayoutException 10, CStructReadException 202
@hash 03ddd3acfa3be2e1c7161482f6362d8e6be148f3a511245adb832f8eba7f01eb 2751 detected-docm
diff --git a/tests/CStructSharpTests/Engine/ReadProgramDump.cs b/tests/CStructSharpTests/Engine/ReadProgramDump.cs
index 2b8925fa..378338ad 100644
--- a/tests/CStructSharpTests/Engine/ReadProgramDump.cs
+++ b/tests/CStructSharpTests/Engine/ReadProgramDump.cs
@@ -106,10 +106,10 @@ private static void RenderOne(StringBuilder text, ReadProgram program, SlotTable
/// The step.
/// The name.
private static string Member(ReadProgram program, ReadStep step)
- => step.Field < 0 ? "-"
- : program.Fields[step.Field].Name is { Length: > 0 } name ? name
- : program.Fields[step.Field].IsPromotedComposite ? "(anonymous)"
- : "(unnamed)";
+ => step.Field < 0 ? "-" :
+ program.Fields[step.Field].Name is { Length: > 0 } name ? name :
+ program.Fields[step.Field].IsPromotedComposite ? "(anonymous)" :
+ "(unnamed)";
/// Describes a step's operands by their meaning.
/// The program.
diff --git a/tests/CStructSharpTests/Generated/ReadCursorTextBoundaryTests.cs b/tests/CStructSharpTests/Generated/ReadCursorTextBoundaryTests.cs
index 30962bc7..a3217e57 100644
--- a/tests/CStructSharpTests/Generated/ReadCursorTextBoundaryTests.cs
+++ b/tests/CStructSharpTests/Generated/ReadCursorTextBoundaryTests.cs
@@ -180,9 +180,9 @@ public void TerminatedText_ReadsAFirstChunkStringLikeTheChunkedDecoder(Terminate
}
// An invalid unit (a lone UTF-16 surrogate, bytes no UTF-8 or ASCII character has) before the terminator.
- byte[] invalidPayload = kind is TerminatedTextEncoding.Utf16LittleEndian ? [0x41, 0, 0x00, 0xD8, 0, 0,]
- : kind is TerminatedTextEncoding.Utf16BigEndian ? [0, 0x41, 0xD8, 0x00, 0, 0,]
- : [0x41, 0xFF, 0,];
+ byte[] invalidPayload = kind is TerminatedTextEncoding.Utf16LittleEndian ? [0x41, 0, 0x00, 0xD8, 0, 0,] :
+ kind is TerminatedTextEncoding.Utf16BigEndian ? [0, 0x41, 0xD8, 0x00, 0, 0,] :
+ [0x41, 0xFF, 0,];
int unitSize = kind is TerminatedTextEncoding.Utf16LittleEndian or TerminatedTextEncoding.Utf16BigEndian ? 2 : 1;
byte[] invalidSource = [.. invalidPayload, 77, 78,];
DecoderFallbackException expectedCause = Assert.Throws(
diff --git a/tests/CStructSharpTests/Io/AlignmentOriginTests.cs b/tests/CStructSharpTests/Io/AlignmentOriginTests.cs
index 9f47b1aa..3b8cfccd 100644
--- a/tests/CStructSharpTests/Io/AlignmentOriginTests.cs
+++ b/tests/CStructSharpTests/Io/AlignmentOriginTests.cs
@@ -26,13 +26,13 @@ public class AlignmentOriginTests
"nested struct and bitfields",
"struct inner { uint16 x; uint8 y; }; struct rec { uint8 a; inner i; uint32 lo : 4; uint32 hi : 4; uint8 t; };",
"rec.t",
- new Dictionary { ["a"] = (byte)1, ["i"] = new Dictionary { ["x"] = (ushort)2, ["y"] = (byte)3, }, ["lo"] = 4u, ["hi"] = 5u, ["t"] = (byte)6, }
+ new Dictionary { ["a"] = (byte)1, ["i"] = new Dictionary { ["x"] = (ushort)2, ["y"] = (byte)3, }, ["lo"] = 4u, ["hi"] = 5u, ["t"] = (byte)6, },
],
[
"runtime-sized array",
"struct rec { uint8 n; uint16 v[n]; uint8 t; uint32 w; };",
"rec.w",
- new Dictionary { ["n"] = (byte)2, ["v"] = new ushort[] { 7, 8, }, ["t"] = (byte)9, ["w"] = 0xAABBCCDDu, }
+ new Dictionary { ["n"] = (byte)2, ["v"] = new ushort[] { 7, 8, }, ["t"] = (byte)9, ["w"] = 0xAABBCCDDu, },
],
];
diff --git a/tests/CStructSharpTests/Io/ExceptionTranslatingStreamTests.cs b/tests/CStructSharpTests/Io/ExceptionTranslatingStreamTests.cs
index 2510f847..627b68fa 100644
--- a/tests/CStructSharpTests/Io/ExceptionTranslatingStreamTests.cs
+++ b/tests/CStructSharpTests/Io/ExceptionTranslatingStreamTests.cs
@@ -213,7 +213,11 @@ private sealed class SelectiveFaultStream(Exception cause) : Stream
public override long Position
{
- get => this.Point == FaultPoint.PositionGet ? throw cause : this.position;
+ get
+ {
+ return this.Point == FaultPoint.PositionGet ? throw cause : this.position;
+ }
+
set
{
if (this.Point == FaultPoint.PositionSet)
diff --git a/tests/CStructSharpTests/Paths/AddressTraversalBoundaryTests.cs b/tests/CStructSharpTests/Paths/AddressTraversalBoundaryTests.cs
index 7b582af6..c07c1c86 100644
--- a/tests/CStructSharpTests/Paths/AddressTraversalBoundaryTests.cs
+++ b/tests/CStructSharpTests/Paths/AddressTraversalBoundaryTests.cs
@@ -111,7 +111,11 @@ public RejectPositionStream(byte[] bytes)
/// Position assignments fail once rejection is enabled.
public override long Position
{
- get => base.Position;
+ get
+ {
+ return base.Position;
+ }
+
set
{
if (this.RejectPositionWrites)
diff --git a/tests/CStructSharpTests/Quality/FeatureOperationMatrixTests.cs b/tests/CStructSharpTests/Quality/FeatureOperationMatrixTests.cs
index 3b45a2a8..80fa73b9 100644
--- a/tests/CStructSharpTests/Quality/FeatureOperationMatrixTests.cs
+++ b/tests/CStructSharpTests/Quality/FeatureOperationMatrixTests.cs
@@ -559,8 +559,7 @@ private static IEnumerable RepresentativeCases()
ExpectedValue: -1.5);
foreach (string type in new[] { "uuid", "guid" })
{
- byte[] id = Convert.FromHexString(type == "uuid"
- ? "00112233445566778899AABBCCDDEEFF" : "33221100554477668899AABBCCDDEEFF");
+ byte[] id = Convert.FromHexString(type == "uuid" ? "00112233445566778899AABBCCDDEEFF" : "33221100554477668899AABBCCDDEEFF");
byte[] original = [.. new byte[16], .. id, 99];
yield return new MatrixCase(
type + "-array",
diff --git a/tests/CStructSharpTests/Reading/PartialMemoryReadCursorTests.cs b/tests/CStructSharpTests/Reading/PartialMemoryReadCursorTests.cs
index 0f367e19..ba2c365c 100644
--- a/tests/CStructSharpTests/Reading/PartialMemoryReadCursorTests.cs
+++ b/tests/CStructSharpTests/Reading/PartialMemoryReadCursorTests.cs
@@ -114,7 +114,7 @@ public unsafe void KnownLength_SurvivesThePackedSplit(long whole)
public void Core_KeepsItsSize()
{
// Two pointer-sized members (the region and the array), four longs, and one 8-byte group of small members.
- Assert.AreEqual((2 * IntPtr.Size) + (4 * sizeof(long)) + 8, Unsafe.SizeOf());
+ Assert.AreEqual((2 * nint.Size) + (4 * sizeof(long)) + 8, Unsafe.SizeOf());
}
/// Reads one byte at from a fresh partly buffered cursor.
diff --git a/tests/CStructSharpTests/TestStreams/PositionCountingStream.cs b/tests/CStructSharpTests/TestStreams/PositionCountingStream.cs
index 37899c4a..e076a7a5 100644
--- a/tests/CStructSharpTests/TestStreams/PositionCountingStream.cs
+++ b/tests/CStructSharpTests/TestStreams/PositionCountingStream.cs
@@ -15,6 +15,9 @@ public override long Position
return base.Position;
}
- set => base.Position = value;
+ set
+ {
+ base.Position = value;
+ }
}
}
diff --git a/tests/CStructSharpTests/TestStreams/RecordingStream.cs b/tests/CStructSharpTests/TestStreams/RecordingStream.cs
index 2a12564a..fd450c76 100644
--- a/tests/CStructSharpTests/TestStreams/RecordingStream.cs
+++ b/tests/CStructSharpTests/TestStreams/RecordingStream.cs
@@ -64,7 +64,11 @@ public RecordingStream(byte[] bytes)
///
public override long Position
{
- get => this.PositionReadFailure is null ? this.inner.Position : throw this.PositionReadFailure;
+ get
+ {
+ return this.PositionReadFailure is null ? this.inner.Position : throw this.PositionReadFailure;
+ }
+
set
{
if (this.PositionFailure is not null)
diff --git a/tests/CStructSharpTests/Text/PrimitiveTextBoundaryTests.cs b/tests/CStructSharpTests/Text/PrimitiveTextBoundaryTests.cs
index 7fc48230..a6319d5d 100644
--- a/tests/CStructSharpTests/Text/PrimitiveTextBoundaryTests.cs
+++ b/tests/CStructSharpTests/Text/PrimitiveTextBoundaryTests.cs
@@ -120,7 +120,11 @@ public ObservedPositionStream()
/// Gets or changes the cursor while counting explicit repositioning requests.
public override long Position
{
- get => base.Position;
+ get
+ {
+ return base.Position;
+ }
+
set
{
this.PositionWrites++;
diff --git a/tests/CStructSharpTests/Writing/UpdateAtomicityTests.cs b/tests/CStructSharpTests/Writing/UpdateAtomicityTests.cs
index 6bdcd22d..ae45ce37 100644
--- a/tests/CStructSharpTests/Writing/UpdateAtomicityTests.cs
+++ b/tests/CStructSharpTests/Writing/UpdateAtomicityTests.cs
@@ -593,7 +593,11 @@ private sealed class CommitFaultStream(
public override long Position
{
- get => this.inner.Position;
+ get
+ {
+ return this.inner.Position;
+ }
+
set
{
if (this.commitFailed)
diff --git a/tools/build/PublicDocumentation/Program.cs b/tools/build/PublicDocumentation/Program.cs
index 7d8adf42..359010ca 100644
--- a/tools/build/PublicDocumentation/Program.cs
+++ b/tools/build/PublicDocumentation/Program.cs
@@ -202,8 +202,9 @@ string NameOf(TypeDefinitionHandle handle)
TypeDefinition definition = reader.GetTypeDefinition(handle);
string simple = reader.GetString(definition.Name);
TypeDefinitionHandle declaring = definition.GetDeclaringType();
- string name = !declaring.IsNil ? NameOf(declaring) + "." + simple
- : definition.Namespace.IsNil ? simple : reader.GetString(definition.Namespace) + "." + simple;
+ string name = !declaring.IsNil ? NameOf(declaring) + "." + simple :
+ definition.Namespace.IsNil ? simple :
+ reader.GetString(definition.Namespace) + "." + simple;
names[handle] = name;
return name;
}
diff --git a/tools/quality/CSharpComments.cs b/tools/quality/CSharpComments.cs
index d3e7d1ab..8f9d2359 100644
--- a/tools/quality/CSharpComments.cs
+++ b/tools/quality/CSharpComments.cs
@@ -43,7 +43,7 @@ public static int Main()
int line = node.GetLocation().GetLineSpan().StartLinePosition.Line + 1;
issues.Add(node is LocalFunctionStatementSyntax
? $"{file}:{line}: {node.Kind()} needs a comment above it stating its purpose."
- : $"{file}:{line}: {node.Kind()} needs a non-empty XML summary or accurate inheritdoc.");
+ : $"{file}:{line}: {node.Kind()} needs a non-empty XML summary (content on a secondary partial type) or accurate inheritdoc.");
}
}
}
@@ -55,7 +55,9 @@ public static int Main()
///
/// Recognizes a non-empty XML summary or explicit inherited documentation immediately on a declaration. A local
/// function cannot carry XML documentation (the compiler reports CS1587), so a non-empty // comment
- /// directly above it documents it instead.
+ /// directly above it documents it instead. A partial type keeps its one summary on its main declaration
+ /// (StyleCop SA1653), so a non-empty content element, describing that file's part, documents any other
+ /// declaration of it.
///
/// The named type, method, constructor, operator or local function to inspect.
/// Whether documentation is present; contract correctness still needs human review.
@@ -66,6 +68,7 @@ private static bool HasDocumentation(SyntaxNode node)
return node.GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.SingleLineCommentTrivia) && trivia.ToString().TrimStart('/').Trim().Length > 0);
}
+ bool isPartialType = node is TypeDeclarationSyntax type && type.Modifiers.Any(SyntaxKind.PartialKeyword);
foreach (SyntaxTrivia trivia in node.GetLeadingTrivia())
{
if (trivia.GetStructure() is not DocumentationCommentTriviaSyntax documentation)
@@ -81,7 +84,8 @@ private static bool HasDocumentation(SyntaxNode node)
}
// Inspect token values, not exterior "///" trivia that can make an empty multiline summary look non-empty.
- if (content is XmlElementSyntax element && element.StartTag.Name.LocalName.Text == "summary" &&
+ if (content is XmlElementSyntax element &&
+ (element.StartTag.Name.LocalName.Text == "summary" || (isPartialType && element.StartTag.Name.LocalName.Text == "content")) &&
element.Content.SelectMany(part => part.DescendantTokens()).Any(token => !string.IsNullOrWhiteSpace(token.ValueText)))
{
return true;
diff --git a/tools/quality/changed-documentation.test.mjs b/tools/quality/changed-documentation.test.mjs
index 164d1b75..1127e43c 100644
--- a/tools/quality/changed-documentation.test.mjs
+++ b/tools/quality/changed-documentation.test.mjs
@@ -12,7 +12,8 @@ test("changed ranges retain deletion boundaries and exact added spans", () => {
});
// Run the real Roslyn checker, including a constructor, local functions and an undocumented untouched method. A local
-// function takes a plain comment, because C# does not accept XML documentation there.
+// function takes a plain comment, because C# does not accept XML documentation there. A element documents
+// only a partial type's secondary declaration.
test("C# checker detects missing XML comments only in changed declaration spans", () => {
const source = "/// A sample.\nclass Sample {\nvoid Legacy() {}\n/// Constructs.\npublic Sample() {}\nvoid Missing() { void Local() {} }\n/// Has a documented helper.\nvoid Outer() {\n// Adds one.\nint Next(int x) => x + 1;\n}\n}";
const entries = [
@@ -20,13 +21,16 @@ test("C# checker detects missing XML comments only in changed declaration spans"
{ file: "local.cs", source, ranges: [{ start: 8, end: 11 }] },
{ file: "failing.cs", source, ranges: [{ start: 6, end: 6 }] },
{ file: "empty.cs", source: "/// \n/// \nclass Empty {}", ranges: [{ start: 1, end: 3 }] },
+ { file: "part.cs", source: "/// The reading part.\npartial class Part {}", ranges: [{ start: 1, end: 2 }] },
+ { file: "whole.cs", source: "/// Not a partial type.\nclass Whole {}", ranges: [{ start: 1, end: 2 }] },
];
const output = execFileSync("dotnet", ["run", "--file", "tools/quality/CSharpComments.cs"], {
cwd: repositoryRoot, input: JSON.stringify({ entries }), encoding: "utf8",
});
const marker = "DOC-COMMENT-RESULT:";
const issues = JSON.parse(output.split(/\r?\n/).find((line) => line.startsWith(marker)).slice(marker.length));
- assert.equal(issues.length, 3);
+ assert.equal(issues.length, 4);
assert.equal(issues.filter((issue) => issue.startsWith("failing.cs:6:")).length, 2);
assert.ok(issues.some((issue) => issue.startsWith("empty.cs:3:")));
+ assert.ok(issues.some((issue) => issue.startsWith("whole.cs:2:")));
});
diff --git a/tools/quality/mutation-declarations.test.mjs b/tools/quality/mutation-declarations.test.mjs
index 0cf03503..98bcc41f 100644
--- a/tools/quality/mutation-declarations.test.mjs
+++ b/tools/quality/mutation-declarations.test.mjs
@@ -133,7 +133,8 @@ test("source changes, tool upgrades, duplicates and out-of-scope policy entries
policy.strykerVersion = "different";
fs.writeFileSync(policyPath, JSON.stringify(policy));
assert.throws(() => loadNonMutableDeclarations(f.root, f.config.mutate), /Stryker version change/);
- policy.strykerVersion = "5.0.0";
+ // Restore agreement with the copied tool manifest so the next assertion exercises only the duplicate check.
+ policy.strykerVersion = JSON.parse(fs.readFileSync(path.join(f.root, ".config/dotnet-tools.json"), "utf8")).tools["dotnet-stryker"].version;
policy.declarations.push(policy.declarations[0]);
fs.writeFileSync(policyPath, JSON.stringify(policy));
assert.throws(() => loadNonMutableDeclarations(f.root, f.config.mutate), /Duplicate non-mutable/);