Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ updates:
- "patch"
exclude-patterns:
- "System.Security.Cryptography.Pkcs"
ignore:
# Directory.Packages.props pins Pkcs per target framework: 10.0.x for net10.0 and 11.0.x for
# net11.0. Without this rule Dependabot can propose 11.x for the net10.0 entry, which would
# put System.Formats.Asn1 11 into a net10.0 consumer. How it treats two conditional entries
# for one package has not yet been observed, so read the first Pkcs PR against this file to
# confirm it changes only one line before merging. A move of the net11.0 line to 12.x is a
# manual edit, made when net12.0 is added. ci.yml's "Check Pkcs per target framework" step
# fails the build if the net10.0 package group ever names a Pkcs version outside 10.x.
- dependency-name: "System.Security.Cryptography.Pkcs"
update-types: ["version-update:semver-major"]

- package-ecosystem: "github-actions"
directory: "/"
Expand All @@ -35,7 +45,7 @@ updates:
commit-message:
prefix: "chore(deps)"
# This updater parses global.json but does not act on rollForward, so it proposes SDKs
# outside the pinned 10.0.4xx feature band (a later 10.0.5xx, eventually 11.x) as readily as
# outside the pinned 11.0.1xx feature band (a later 11.0.2xx, eventually 12.x) as readily as
# ones inside it. That is intended, not a bug in this config: #379 pins the band deliberately
# and its CONTRIBUTING rule requires a human to merge a band move on purpose and CI-validate
# it before the next tag, so each such PR is that signal, not noise to dismiss.
544 changes: 369 additions & 175 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
- name: Install DocFX
run: dotnet tool update -g docfx

# The API docs are generated from net10.0: docfx.json passes TargetFramework=net10.0 to the
# projects it documents, which selects that one framework out of the two each library builds.
# The public API files and the sources are shared by both, so one framework describes the
# surface, and the LTS target is the one that stays pinned.
- name: Generate API metadata
run: docfx metadata docfx.json

Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/fuzz-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,24 @@ permissions:
jobs:
fuzz:
runs-on: ubuntu-24.04
# A budget two orders of magnitude past ci.yml's own needs far more headroom than that
# workflow's 30-minute job — this one runs alone on a schedule, not alongside CI's other gates,
# so there is no shared budget to protect.
# A budget two orders of magnitude past ci.yml's own needs far more headroom than ci.yml's job
# timeout. This one runs alone on a schedule, not alongside CI's other gates, so there is no
# shared budget to protect.
timeout-minutes: 180
env:
VELLUMPDF_FUZZ_ITER: ${{ inputs.iterations || '200000' }}
steps:
- uses: actions/checkout@v7

# The Reader test project now targets net10.0 and net11.0. The nightly budget stays on the
# LTS target (-f net10.0 below): the parser under fuzz is the same source for both frameworks,
# so a second framework would add random inputs against the same code at twice the run time
# inside the 180-minute timeout. global.json pins SDK 11, whose install does not carry the
# net10.0 runtime, hence the explicit dotnet-version.
- uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
dotnet-version: 10.0.x

- run: dotnet --version

Expand All @@ -50,7 +56,7 @@ jobs:
continue-on-error: true
run: |
set -euo pipefail
dotnet test tests/VellumPdf.Reader.Tests/VellumPdf.Reader.Tests.csproj -c Release \
dotnet test tests/VellumPdf.Reader.Tests/VellumPdf.Reader.Tests.csproj -c Release -f net10.0 \
--filter "FullyQualifiedName~ParserFuzzTests" \
2>&1 | tee fuzz-output.log

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ jobs:
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --quiet --norestart | Out-Null
Write-Host "ARM64 VC toolset install requested for $vsPath"

# -f net10.0: VellumPdf.Cli multi-targets, and publishing a multi-targeted Exe without -f
# fails with NETSDK1129. The native binary ships from the LTS target.
- name: Publish native AOT binary
shell: bash
run: >
dotnet publish src/VellumPdf.Cli -c Release -r ${{ matrix.rid }}
dotnet publish src/VellumPdf.Cli -c Release -r ${{ matrix.rid }} -f net10.0
-p:PublishAot=true
-p:Version="${{ steps.version.outputs.version }}"
-o publish-out
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,33 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Changed

- **Every package now targets `net10.0` and `net11.0`, built with the .NET 11 SDK (`global.json`
pins 11.0.100, latest patch).** The seven library nupkgs carry `lib/net10.0` and `lib/net11.0`;
the `VellumPdf.Cli` tool package carries `tools/net10.0/any` and `tools/net11.0/any`. The public
API files are shared by both frameworks and no source file branches on the target framework. The
language version is now pinned to C# 14 rather than following the SDK. Both runtimes reach end of
support on 2028-11-14, and VellumPdf keeps both targets until that date. `VellumPdf.Signing` takes
`System.Security.Cryptography.Pkcs` 10.0.14 on `net10.0` and 11.0.0 on `net11.0`, so a `net10.0`
consumer does not pick up the 11.0.0 package's `System.Formats.Asn1` 11 dependency. Contributors
need the .NET 10 runtime installed beside the 11.0 SDK to run the `net10.0` test assemblies.
- **The native `vellum-preflight` binaries on the GitHub Release are published from `net10.0`.**
Publishing a multi-targeted executable needs an explicit `-f`, and the LTS target is the one
chosen.
- **CI gates run per target framework.** Each test project runs on both frameworks and writes its
coverage report to `<project>/<tfm>_<arch>/` (`--results-directory-layout per-module`). The
coverage gate requires exactly one report in each of the 14 expected directories, checks every
report against the assemblies its project must instrument, applies the assembly-name,
per-assembly-floor, valid-line and 84% threshold checks to each framework and the assembly-name,
per-assembly-floor, valid-line, 84% threshold and total-line checks to the merge, and fails on a
report anywhere else. The oracle invocation floors are checked per framework, and a framework
whose runs logged nothing fails; the verapdf and qpdf floors are now 279 and 51, 90% of the
counts the first Linux CI run measured. A new Pack-time check fails the build if the `net10.0`
package group of `VellumPdf.Signing` names a Pkcs version outside 10.x. The job timeout stays at
60 minutes: the first CI run on both frameworks took 29 minutes, 23 of them in the Test step.
The per-package README is now attached
with remove-then-include, because an update matches nothing in the outer build that packs a
multi-targeted project.

- **CI's oracles move to veraPDF 1.30.4 and qpdf 12.4.2.** `VERAPDF_TAG` was v1.30.2 and
`QPDF_VERSION` was 12.4.1 (#230); the qpdf checksum moves with it. The veraPDF release notes
for 1.30.3 and 1.30.4 list changes that can move a verdict on the PDF/A-2a, 2b, 2u and PDF/UA-1
Expand Down
30 changes: 21 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ build, test, and submit changes to VellumPdf.

## Prerequisites

- **.NET 10 SDK**, feature band 10.0.4xx — the exact pin is in `global.json`;
earlier feature bands are rejected.
- **.NET 11 SDK**, feature band 11.0.1xx — the exact pin is in `global.json`;
earlier feature bands are rejected. The libraries and tests target both `net10.0` and
`net11.0`, so the **.NET 10 runtime** must be installed too: the 11.0 SDK does not carry it, and a
`net10.0` test host cannot start without it.
- Before tagging a release: merge and CI-validate any `global.json`
feature-band bump first. `release.yml` reads `global.json` from the tag's
tree, so a stale pin ships a release built on a superseded SDK band.
Expand Down Expand Up @@ -161,12 +163,14 @@ that gap from the workflow side rather than in-process, since the suite runs
each test assembly as its own process and nothing guarantees which one runs
last. `ci.yml`'s Test step sets `ORACLE_INVOCATION_LOG`, which makes
`ExternalTool.RunProcess` append one `tool<TAB>first-argument` line per
successful, non-probe call to a per-process file — an identity probe and a
launch that never started are both excluded, so neither can pad a tool's
count without the tool having actually validated anything; a step after
Test concatenates those files, sums a count per tool, and fails the build if
any tool falls below a floor pinned next to that count. The env var is
unset locally, so this is a no-op outside CI.
successful, non-probe call to a per-process, per-target-framework file named
`<base>.<tfm>.<pid>`. An identity probe and a launch that never started are both
excluded, so neither can pad a tool's count without the tool having actually
validated anything. A step after Test concatenates each target framework's
files, sums a count per tool, and fails the build if any tool falls below a
floor pinned next to that count under either `net10.0` or `net11.0`; a
framework with no log files at all fails too. The env var is unset locally, so
this is a no-op outside CI.

A tool that runs and answers is not the same as a tool that discriminated.
`qpdf --show-linearization` exits 0 and prints no `WARNING` for both a
Expand All @@ -191,9 +195,17 @@ own output directory as `testconfig.json` by `tests/Directory.Build.props`) rath
switch:

```bash
dotnet test VellumPdf.slnx -c Release --results-directory <dir> -- --coverlet
dotnet test VellumPdf.slnx -c Release --results-directory-layout per-module \
--results-directory <dir> -- --coverlet
```

Without `--results-directory-layout per-module` the gate cannot attribute a report: every test
project now runs once per target framework, and coverlet.MTP names a report only by its write
timestamp, so the flat layout puts the net10.0 and net11.0 reports of one project in the same
directory, where two that finish in the same millisecond could overwrite each other. Per-module
writes
`<dir>/<project>/<tfm>_<arch>/`, which is also how the gate tells the reports apart.

`coverlet.testconfig.json` scopes instrumentation to the eight shipping assemblies, the same
scope `coverlet.runsettings` held under the old VSTest collector (#229), as an include allow-list
rather than an exclude list. That distinction matters here specifically because coverlet.MTP's
Expand Down
18 changes: 16 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,22 @@

<!-- Shared settings for every project in the repository. -->
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>latest</LangVersion>
<!--
Both supported runtimes, built from one SDK. net10.0 is the LTS and net11.0 the STS release
(both end of support 2028-11-14). Replacing TargetFramework, rather than adding beside it, is
what makes this multi-target: a non-empty TargetFramework wins over TargetFrameworks even
when both are set in this one file, and a probe of a project that sets TargetFramework under
a props file that sets TargetFrameworks restored both frameworks but built one.
-->
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
<!--
Pinned, not "latest". "latest" follows the SDK: on SDK 11.0.100 it compiled both frameworks as
C# 15 (measured with a #error version probe), where SDK 10.0.404 gave 14.0. Features such as
extension indexers need no new runtime type, so they would compile for net10.0 as well and hand
net10.0 consumers on SDK 10 a surface built for C# 15. The language version moves by an
explicit, reviewed change, not with the SDK band.
-->
<LangVersion>14</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
7 changes: 5 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
<!--
Kept in the same major band as the target framework. It was pinned at 9.0.5 on a net10.0-only
library, so the one third-party runtime dependency this repository ships — and it ships on the
signing package — was a servicing-stale .NET 9 build.
signing package — was a servicing-stale .NET 9 build. With two target frameworks each one
takes its own major band: the 11.0.0 package's net10.0 group would pull System.Formats.Asn1
11.0.0 into a net10.0 consumer, and its net11.0 group takes no dependency at all.
-->
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="10.0.14" />
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="10.0.14" Condition="'$(TargetFramework)' == 'net10.0'" />
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="11.0.0" Condition="'$(TargetFramework)' == 'net11.0'" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="5.6.0" />
<!-- xunit.v3 ships xunit.v3.core.mtp-v2 / xunit.v3.mtp-v2, which pull in
Microsoft.Testing.Platform; the .NET 10 SDK refuses the VSTest target these tests used to
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
[![NuGet](https://img.shields.io/nuget/v/VellumPdf.Kernel.svg?label=VellumPdf.Kernel)](https://www.nuget.org/packages/VellumPdf.Kernel)
[![NuGet](https://img.shields.io/nuget/v/VellumPdf.Conformance.svg?label=VellumPdf.Conformance)](https://www.nuget.org/packages/VellumPdf.Conformance)

A modern, **dependency-free PDF generation library for .NET 10**, implemented
A modern, **dependency-free PDF generation library for .NET 10 and .NET 11**, implemented
clean-room from the open **ISO 32000** standard.

> **Status: stable.** The public API is locked (analyzer-enforced) and
> the library targets .NET 10. Core features are CI-validated — including
> the library targets .NET 10 and .NET 11. Core features are CI-validated — including
> PDF/A-2a/2b/2u and PDF/UA-1 conformance proven on every push with veraPDF.

## Why VellumPdf
Expand Down Expand Up @@ -328,7 +328,12 @@ as these milestones land. `VellumPdf.Conformance` graduated to Stable in 2.0.

## Building

Requires the .NET 10 SDK.
Requires the .NET 11 SDK. The libraries build for `net10.0` and `net11.0` and ship both, so a
project targeting `net10.0` restores the `net10.0` assembly, and one targeting `net11.0` or later
restores the `net11.0` assembly. The two target frameworks reach end of support on the same day,
2028-11-14, and VellumPdf keeps both targets until that date.

Running the test suite on `net10.0` also needs the .NET 10 runtime installed beside the SDK.

```bash
dotnet build VellumPdf.slnx
Expand Down
6 changes: 4 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## Goal

A full-featured PDF **generation** library for .NET 10, comparable in capability
A full-featured PDF **generation** library for .NET 10 and .NET 11, comparable in capability
to a mature commercial PDF SDK, implemented **clean-room** from the open
**ISO 32000** standard.

Expand Down Expand Up @@ -168,7 +168,9 @@ to retrofit:
## Defaults & conventions

- Default page size **A4**; default units **metric (millimetres)**.
- Target framework **net10.0** only (and later).
- Target frameworks **net10.0** and **net11.0**, built from one SDK (11.0.1xx). Both ship in every
package: under `lib/` for the seven libraries, under `tools/` for `VellumPdf.Cli`; no source file
branches on the target framework.
- Modern C# 14: `readonly record struct` for value types (Rect/Matrix/Color),
`ReadOnlySpan<byte>` + UTF-8 (`u8`) literals for fixed tokens,
`SearchValues<byte>` for delimiter scanning, `FrozenDictionary` for metric
Expand Down
5 changes: 3 additions & 2 deletions eng/aot/VellumPdf.AotSmoke/VellumPdf.AotSmoke.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
Manual Native AOT validation harness (not a unit-test project).
Lives under eng/ so the tests/Directory.Build.props (xUnit) does not apply
and the clean-room scan excludes it. Not part of VellumPdf.slnx; published
directly by path: dotnet publish eng/aot/VellumPdf.AotSmoke -c Release -r <rid>
directly by path: dotnet publish eng/aot/VellumPdf.AotSmoke -c Release -r <rid> -f <tfm>
(a multi-targeted Exe needs -f, or the publish fails with NETSDK1129; run-aot-smoke.ps1 does both TFMs)
-->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PublishAot>true</PublishAot>
Expand Down
50 changes: 28 additions & 22 deletions eng/aot/run-aot-smoke.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,34 @@ if (Test-Path $installer) { $env:PATH = "$installer;$env:PATH" }
$rid = if ($IsWindows -or $null -eq $IsWindows) { 'win-x64' } elseif ($IsMacOS) { if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq [System.Runtime.InteropServices.Architecture]::Arm64) { 'osx-arm64' } else { 'osx-x64' } } else { 'linux-x64' }
$proj = Join-Path $PSScriptRoot 'VellumPdf.AotSmoke\VellumPdf.AotSmoke.csproj'

Write-Host "Publishing Native AOT ($rid)..." -ForegroundColor Cyan
dotnet publish $proj -c Release -r $rid
if ($LASTEXITCODE -ne 0) { throw "AOT publish failed (exit $LASTEXITCODE)" }

$exeName = if ($rid -like 'win-*') { 'VellumPdf.AotSmoke.exe' } else { 'VellumPdf.AotSmoke' }
$exe = Join-Path $PSScriptRoot "VellumPdf.AotSmoke\bin\Release\net10.0\$rid\publish\$exeName"

Write-Host "Running $exe" -ForegroundColor Cyan
& $exe
if ($LASTEXITCODE -ne 0) { throw "AOT smoke run failed (exit $LASTEXITCODE)" }

# The vellum-preflight CLI (issue #130) must also stay Native-AOT clean — it is the
# public front-end over VellumPdf.Conformance and ships as a per-platform native binary.
# A multi-targeted Exe cannot be published without -f (NETSDK1129), and each TFM is a separate
# ILCompiler run against a separate runtime pack, so both are exercised.
$tfms = @('net10.0', 'net11.0')
$cli = Join-Path $PSScriptRoot '..\..\src\VellumPdf.Cli\VellumPdf.Cli.csproj'
Write-Host "Publishing vellum-preflight CLI Native AOT ($rid)..." -ForegroundColor Cyan
dotnet publish $cli -c Release -r $rid
if ($LASTEXITCODE -ne 0) { throw "CLI AOT publish failed (exit $LASTEXITCODE)" }

$cliExeName = if ($rid -like 'win-*') { 'vellum-preflight.exe' } else { 'vellum-preflight' }
$cliExe = Join-Path $PSScriptRoot "..\..\src\VellumPdf.Cli\bin\Release\net10.0\$rid\publish\$cliExeName"
Write-Host "Running $cliExe --coverage 2b" -ForegroundColor Cyan
& $cliExe --coverage 2b
if ($LASTEXITCODE -ne 0) { throw "CLI AOT smoke run failed (exit $LASTEXITCODE)" }

foreach ($tfm in $tfms) {
Write-Host "Publishing Native AOT ($rid, $tfm)..." -ForegroundColor Cyan
dotnet publish $proj -c Release -r $rid -f $tfm
if ($LASTEXITCODE -ne 0) { throw "AOT publish failed for $tfm (exit $LASTEXITCODE)" }

$exeName = if ($rid -like 'win-*') { 'VellumPdf.AotSmoke.exe' } else { 'VellumPdf.AotSmoke' }
$exe = Join-Path $PSScriptRoot "VellumPdf.AotSmoke\bin\Release\$tfm\$rid\publish\$exeName"

Write-Host "Running $exe" -ForegroundColor Cyan
& $exe
if ($LASTEXITCODE -ne 0) { throw "AOT smoke run failed for $tfm (exit $LASTEXITCODE)" }

# The vellum-preflight CLI (issue #130) must also stay Native-AOT clean — it is the
# public front-end over VellumPdf.Conformance and ships as a per-platform native binary.
Write-Host "Publishing vellum-preflight CLI Native AOT ($rid, $tfm)..." -ForegroundColor Cyan
dotnet publish $cli -c Release -r $rid -f $tfm
if ($LASTEXITCODE -ne 0) { throw "CLI AOT publish failed for $tfm (exit $LASTEXITCODE)" }

$cliExeName = if ($rid -like 'win-*') { 'vellum-preflight.exe' } else { 'vellum-preflight' }
$cliExe = Join-Path $PSScriptRoot "..\..\src\VellumPdf.Cli\bin\Release\$tfm\$rid\publish\$cliExeName"
Write-Host "Running $cliExe --coverage 2b" -ForegroundColor Cyan
& $cliExe --coverage 2b
if ($LASTEXITCODE -ne 0) { throw "CLI AOT smoke run failed for $tfm (exit $LASTEXITCODE)" }
}

Write-Host "AOT smoke PASSED." -ForegroundColor Green
Loading
Loading