Skip to content

Separate NSJ Converter in a Companion Package#51

Merged
vmelamed merged 22 commits into
mainfrom
fix/aot
May 29, 2026
Merged

Separate NSJ Converter in a Companion Package#51
vmelamed merged 22 commits into
mainfrom
fix/aot

Conversation

@vmelamed
Copy link
Copy Markdown
Owner

Summary

Separate NSJ converter in a companion Package to preserve AoT compatibility in the main package.
BREAKING CHANGE!

Commits

  • fix: enable AoT, refactor Directory.Build.props
  • chore: update vm2.TestUtilities package version to 1.5.2 and clarify package reference comments
  • refactor!: put the Newtonsoft.Json Ulid converter in a separate project/assembly, allowing for AoT in the main project and non-AoT in that converter only -- BREAKING CHANGE. Updated with diff-shared.sh.

Checklist

  • Commit messages follow Conventional Commits format
  • Tests pass locally, and cover new code and edge cases. Test coverage is above 80%.
  • It is not expected that the performance will degrade by more than 20%
  • Documentation is updated if necessary

vmelamed added 3 commits May 25, 2026 17:02
…ct/assembly, allowing for AoT in the main project and non-AoT in that converter only -- BREAKING CHANGE.

Updated with diff-shared.sh.
Copilot AI review requested due to automatic review settings May 26, 2026 17:59
@github-actions
Copy link
Copy Markdown
Contributor

Summary

Summary
Generated on: 05/26/2026 - 14:01:41
Parser: MultiReport (2x Cobertura)
Assemblies: 3
Classes: 7
Files: 8
Line coverage: 98.3% (355 of 361)
Covered lines: 355
Uncovered lines: 6
Coverable lines: 361
Total lines: 1138
Branch coverage: 91.4% (86 of 94)
Covered branches: 86
Total branches: 94
Method coverage: 100% (53 of 53)
Full method coverage: 92.4% (49 of 53)
Covered methods: 53
Fully covered methods: 49
Total methods: 53
Tag: 545_26465833519

Coverage

UlidNsConverter - 75%
Name Line Branch Method Full method
UlidNsConverter 75% 64.2% 100% 33.3%
vm2.UlidSerialization.NsJson.UlidNsConverter 75% 64.2% 100% 33.3%
UlidTool - 100%
Name Line Branch Method Full method
UlidTool 100% 100% 100% 100%
UlidToolApp 100% 100% 100% 100%
UlidType - 99.1%
Name Line Branch Method Full method
UlidType 99.1% 95.1% 100% 95.8%
vm2.Providers.CryptoRandom 100% 100% 100%
vm2.Providers.PseudoRandom 100% 100% 100%
vm2.Ulid 100% 95.8% 100% 100%
vm2.UlidFactory 100% 100% 100% 100%
vm2.UlidSerialization.SysJson.UlidSysConverter 83.3% 75% 100% 0%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

Summary

Summary
Generated on: 05/26/2026 - 15:12:53
Parser: MultiReport (2x Cobertura)
Assemblies: 3
Classes: 7
Files: 8
Line coverage: 98.3% (355 of 361)
Covered lines: 355
Uncovered lines: 6
Coverable lines: 361
Total lines: 1138
Branch coverage: 91.4% (86 of 94)
Covered branches: 86
Total branches: 94
Method coverage: 100% (53 of 53)
Full method coverage: 92.4% (49 of 53)
Covered methods: 53
Fully covered methods: 49
Total methods: 53
Tag: 549_26469436976

Coverage

UlidNsConverter - 75%
Name Line Branch Method Full method
UlidNsConverter 75% 64.2% 100% 33.3%
vm2.UlidSerialization.NsJson.UlidNsConverter 75% 64.2% 100% 33.3%
UlidTool - 100%
Name Line Branch Method Full method
UlidTool 100% 100% 100% 100%
UlidToolApp 100% 100% 100% 100%
UlidType - 99.1%
Name Line Branch Method Full method
UlidType 99.1% 95.1% 100% 95.8%
vm2.Providers.CryptoRandom 100% 100% 100%
vm2.Providers.PseudoRandom 100% 100% 100%
vm2.Ulid 100% 95.8% 100% 100%
vm2.UlidFactory 100% 100% 100% 100%
vm2.UlidSerialization.SysJson.UlidSysConverter 83.3% 75% 100% 0%

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR splits the Newtonsoft.Json ULID converter out of the main vm2.Ulid product so the primary package can remain AoT-compatible, while offering Newtonsoft.Json support via a companion package (vm2.UlidSerialization.NsJson). This is a breaking change because vm2.Ulid is no longer annotated with a Newtonsoft.Json converter attribute.

Changes:

  • Introduces a new companion project/package (src/UlidNsConverter) that contains the Newtonsoft.Json UlidNsConverter.
  • Removes Newtonsoft.Json coupling from src/UlidType (incl. removing the Newtonsoft converter attribute on Ulid) to preserve AoT compatibility.
  • Refactors build/CI/package configuration (Directory.Build.props, central package versions, CI packaging list) to align with the new project split.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/UlidType.Tests/usings.cs Adds global usings for Newtonsoft.Json and the new companion converter namespace used by tests.
test/UlidType.Tests/UlidType.Tests.csproj References the new UlidNsConverter project so tests can exercise the companion converter.
test/UlidType.Tests/packages.lock.json Updates dependency lock to reflect the new project reference and revised dependency graph.
test/UlidType.Tests/NsJson/UlidNsConverterTests.cs Updates Newtonsoft.Json converter tests to use new wiring (incl. default settings).
test/UlidTool.Tests/packages.lock.json Updates dependency lock to reflect the revised dependency graph.
src/UlidType/usings.cs Removes NsJson-related usings to decouple the main library from Newtonsoft.Json.
src/UlidType/Ulid.cs Removes the Newtonsoft.Json converter attribute (breaking change) while keeping System.Text.Json converter.
src/UlidType/packages.lock.json Updates dependency lock after removing Newtonsoft.Json and other removed direct refs.
src/UlidTool/UlidTool.csproj Marks the tool project as not AoT compatible / disables AoT reference verification.
src/UlidTool/packages.lock.json Updates dependency lock to reflect removed dependencies and AoT refactoring.
src/UlidNsConverter/UlidNsConverter.csproj Adds new companion package project that depends on Newtonsoft.Json and references UlidType.
src/UlidNsConverter/UlidNsConverter.cs Adjusts converter implementation to explicitly call vm2.Ulid.Parse(...) after project split.
src/UlidNsConverter/packages.lock.json Adds lock file for the new companion package project.
README.md Documents AoT focus and adds serialization guidance pointing to the new companion package.
examples/packages.lock.json Updates dependency lock to reflect revised dependency graph.
Directory.Packages.props Refactors central package versions (moves/removes versions now no longer used broadly).
Directory.Build.props Adds project-role detection + AoT defaults and refactors common/test/build settings.
benchmarks/UlidType.Benchmarks/packages.lock.json Updates benchmark dependency lock to reflect revised dependency graph.
.github/workflows/CI.yaml Adds the new companion project to the list of package projects built/packed in CI.

Comment thread Directory.Build.props Outdated
Comment thread README.md Outdated
Comment thread test/UlidType.Tests/NsJson/UlidNsConverterTests.cs Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

Summary

Summary
Generated on: 05/26/2026 - 15:52:20
Parser: MultiReport (2x Cobertura)
Assemblies: 3
Classes: 7
Files: 8
Line coverage: 98.3% (355 of 361)
Covered lines: 355
Uncovered lines: 6
Coverable lines: 361
Total lines: 1138
Branch coverage: 91.4% (86 of 94)
Covered branches: 86
Total branches: 94
Method coverage: 100% (53 of 53)
Full method coverage: 92.4% (49 of 53)
Covered methods: 53
Fully covered methods: 49
Total methods: 53
Tag: 550_26471417257

Coverage

Ulid - 99.1%
Name Line Branch Method Full method
Ulid 99.1% 95.1% 100% 95.8%
vm2.Providers.CryptoRandom 100% 100% 100%
vm2.Providers.PseudoRandom 100% 100% 100%
vm2.Ulid 100% 95.8% 100% 100%
vm2.UlidFactory 100% 100% 100% 100%
vm2.UlidSerialization.SysJson.UlidSysConverter 83.3% 75% 100% 0%
UlidNsConverter - 75%
Name Line Branch Method Full method
UlidNsConverter 75% 64.2% 100% 33.3%
vm2.UlidSerialization.NsJson.UlidNsConverter 75% 64.2% 100% 33.3%
UlidTool - 100%
Name Line Branch Method Full method
UlidTool 100% 100% 100% 100%
UlidToolApp 100% 100% 100% 100%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

Summary

Summary
Generated on: 05/27/2026 - 20:21:47
Parser: MultiReport (2x Cobertura)
Assemblies: 3
Classes: 7
Files: 8
Line coverage: 98.3% (355 of 361)
Covered lines: 355
Uncovered lines: 6
Coverable lines: 361
Total lines: 1134
Branch coverage: 91.4% (86 of 94)
Covered branches: 86
Total branches: 94
Method coverage: 100% (53 of 53)
Full method coverage: 92.4% (49 of 53)
Covered methods: 53
Fully covered methods: 49
Total methods: 53
Tag: 573_26546684283

Coverage

vm2.Serialization.NsJson.Ulid - 75%
Name Line Branch Method Full method
vm2.Serialization.NsJson.Ulid 75% 64.2% 100% 33.3%
vm2.Serialization.NsJson.Ulid.UlidConverter 75% 64.2% 100% 33.3%
vm2.Ulid - 99.1%
Name Line Branch Method Full method
vm2.Ulid 99.1% 95.1% 100% 95.8%
vm2.Providers.Ulid.CryptoRandom 100% 100% 100%
vm2.Providers.Ulid.PseudoRandom 100% 100% 100%
vm2.Serialization.SysJson.Ulid.UlidConverter 83.3% 75% 100% 0%
vm2.Ulid 100% 95.8% 100% 100%
vm2.UlidFactory 100% 100% 100% 100%
vm2.UlidTool - 100%
Name Line Branch Method Full method
vm2.UlidTool 100% 100% 100% 100%
UlidToolApp 100% 100% 100% 100%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Summary

Summary
Generated on: 05/27/2026 - 21:16:35
Parser: MultiReport (2x Cobertura)
Assemblies: 3
Classes: 7
Files: 8
Line coverage: 98.3% (355 of 361)
Covered lines: 355
Uncovered lines: 6
Coverable lines: 361
Total lines: 1134
Branch coverage: 91.4% (86 of 94)
Covered branches: 86
Total branches: 94
Method coverage: 100% (53 of 53)
Full method coverage: 92.4% (49 of 53)
Covered methods: 53
Fully covered methods: 49
Total methods: 53
Tag: 577_26548555294

Coverage

vm2.Serialization.NsJson.Ulid - 75%
Name Line Branch Method Full method
vm2.Serialization.NsJson.Ulid 75% 64.2% 100% 33.3%
vm2.Serialization.NsJson.Ulid.UlidConverter 75% 64.2% 100% 33.3%
vm2.Ulid - 99.1%
Name Line Branch Method Full method
vm2.Ulid 99.1% 95.1% 100% 95.8%
vm2.Providers.Ulid.CryptoRandom 100% 100% 100%
vm2.Providers.Ulid.PseudoRandom 100% 100% 100%
vm2.Serialization.SysJson.Ulid.UlidConverter 83.3% 75% 100% 0%
vm2.Ulid 100% 95.8% 100% 100%
vm2.UlidFactory 100% 100% 100% 100%
vm2.UlidTool - 100%
Name Line Branch Method Full method
vm2.UlidTool 100% 100% 100% 100%
UlidToolApp 100% 100% 100% 100%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Summary

Summary
Generated on: 05/27/2026 - 22:34:29
Parser: MultiReport (2x Cobertura)
Assemblies: 3
Classes: 7
Files: 8
Line coverage: 98.3% (355 of 361)
Covered lines: 355
Uncovered lines: 6
Coverable lines: 361
Total lines: 1134
Branch coverage: 91.4% (86 of 94)
Covered branches: 86
Total branches: 94
Method coverage: 100% (53 of 53)
Full method coverage: 92.4% (49 of 53)
Covered methods: 53
Fully covered methods: 49
Total methods: 53
Tag: 578_26551059492

Coverage

vm2.Serialization.NsJson.Ulid - 75%
Name Line Branch Method Full method
vm2.Serialization.NsJson.Ulid 75% 64.2% 100% 33.3%
vm2.Serialization.NsJson.Ulid.UlidConverter 75% 64.2% 100% 33.3%
vm2.Ulid - 99.1%
Name Line Branch Method Full method
vm2.Ulid 99.1% 95.1% 100% 95.8%
vm2.Providers.Ulid.CryptoRandom 100% 100% 100%
vm2.Providers.Ulid.PseudoRandom 100% 100% 100%
vm2.Serialization.SysJson.Ulid.UlidConverter 83.3% 75% 100% 0%
vm2.Ulid 100% 95.8% 100% 100%
vm2.UlidFactory 100% 100% 100% 100%
vm2.UlidTool - 100%
Name Line Branch Method Full method
vm2.UlidTool 100% 100% 100% 100%
UlidToolApp 100% 100% 100% 100%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Summary

Summary
Generated on: 05/28/2026 - 17:15:51
Parser: MultiReport (2x Cobertura)
Assemblies: 3
Classes: 7
Files: 8
Line coverage: 98.3% (355 of 361)
Covered lines: 355
Uncovered lines: 6
Coverable lines: 361
Total lines: 1134
Branch coverage: 91.4% (86 of 94)
Covered branches: 86
Total branches: 94
Method coverage: 100% (53 of 53)
Full method coverage: 92.4% (49 of 53)
Covered methods: 53
Fully covered methods: 49
Total methods: 53
Tag: 589_26602663622

Coverage

Serialization.NsJson.Ulid - 75%
Name Line Branch Method Full method
Serialization.NsJson.Ulid 75% 64.2% 100% 33.3%
vm2.Serialization.NsJson.Ulid.UlidConverter 75% 64.2% 100% 33.3%
Ulid - 99.1%
Name Line Branch Method Full method
Ulid 99.1% 95.1% 100% 95.8%
vm2.Providers.Ulid.CryptoRandom 100% 100% 100%
vm2.Providers.Ulid.PseudoRandom 100% 100% 100%
vm2.Serialization.SysJson.Ulid.UlidConverter 83.3% 75% 100% 0%
vm2.Ulid 100% 95.8% 100% 100%
vm2.UlidFactory 100% 100% 100% 100%
UlidTool - 100%
Name Line Branch Method Full method
UlidTool 100% 100% 100% 100%
UlidToolApp 100% 100% 100% 100%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Summary

Summary
Generated on: 05/28/2026 - 21:03:08
Parser: MultiReport (2x Cobertura)
Assemblies: 3
Classes: 7
Files: 8
Line coverage: 98.3% (355 of 361)
Covered lines: 355
Uncovered lines: 6
Coverable lines: 361
Total lines: 1134
Branch coverage: 91.4% (86 of 94)
Covered branches: 86
Total branches: 94
Method coverage: 100% (53 of 53)
Full method coverage: 92.4% (49 of 53)
Covered methods: 53
Fully covered methods: 49
Total methods: 53
Tag: 591_26611588460

Coverage

Serialization.NsJson.Ulid - 75%
Name Line Branch Method Full method
Serialization.NsJson.Ulid 75% 64.2% 100% 33.3%
vm2.Serialization.NsJson.Ulid.UlidConverter 75% 64.2% 100% 33.3%
Ulid - 99.1%
Name Line Branch Method Full method
Ulid 99.1% 95.1% 100% 95.8%
vm2.Providers.Ulid.CryptoRandom 100% 100% 100%
vm2.Providers.Ulid.PseudoRandom 100% 100% 100%
vm2.Serialization.SysJson.Ulid.UlidConverter 83.3% 75% 100% 0%
vm2.Ulid 100% 95.8% 100% 100%
vm2.UlidFactory 100% 100% 100% 100%
UlidTool - 100%
Name Line Branch Method Full method
UlidTool 100% 100% 100% 100%
UlidToolApp 100% 100% 100% 100%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Summary

Summary
Generated on: 05/29/2026 - 17:48:19
Parser: MultiReport (2x Cobertura)
Assemblies: 3
Classes: 7
Files: 8
Line coverage: 98.3% (355 of 361)
Covered lines: 355
Uncovered lines: 6
Coverable lines: 361
Total lines: 1134
Branch coverage: 91.4% (86 of 94)
Covered branches: 86
Total branches: 94
Method coverage: 100% (53 of 53)
Full method coverage: 92.4% (49 of 53)
Covered methods: 53
Fully covered methods: 49
Total methods: 53
Tag: 595_26663874886

Coverage

Serialization.NsJson.Ulid - 75%
Name Line Branch Method Full method
Serialization.NsJson.Ulid 75% 64.2% 100% 33.3%
vm2.Serialization.NsJson.Ulid.UlidConverter 75% 64.2% 100% 33.3%
Ulid - 99.1%
Name Line Branch Method Full method
Ulid 99.1% 95.1% 100% 95.8%
vm2.Providers.Ulid.CryptoRandom 100% 100% 100%
vm2.Providers.Ulid.PseudoRandom 100% 100% 100%
vm2.Serialization.SysJson.Ulid.UlidConverter 83.3% 75% 100% 0%
vm2.Ulid 100% 95.8% 100% 100%
vm2.UlidFactory 100% 100% 100% 100%
UlidTool - 100%
Name Line Branch Method Full method
UlidTool 100% 100% 100% 100%
UlidToolApp 100% 100% 100% 100%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Summary

Summary
Generated on: 05/29/2026 - 18:03:40
Parser: MultiReport (2x Cobertura)
Assemblies: 3
Classes: 7
Files: 8
Line coverage: 98.3% (355 of 361)
Covered lines: 355
Uncovered lines: 6
Coverable lines: 361
Total lines: 1134
Branch coverage: 91.4% (86 of 94)
Covered branches: 86
Total branches: 94
Method coverage: 100% (53 of 53)
Full method coverage: 92.4% (49 of 53)
Covered methods: 53
Fully covered methods: 49
Total methods: 53
Tag: 597_26664485108

Coverage

Serialization.NsJson.Ulid - 75%
Name Line Branch Method Full method
Serialization.NsJson.Ulid 75% 64.2% 100% 33.3%
vm2.Serialization.NsJson.Ulid.UlidConverter 75% 64.2% 100% 33.3%
Ulid - 99.1%
Name Line Branch Method Full method
Ulid 99.1% 95.1% 100% 95.8%
vm2.Providers.Ulid.CryptoRandom 100% 100% 100%
vm2.Providers.Ulid.PseudoRandom 100% 100% 100%
vm2.Serialization.SysJson.Ulid.UlidConverter 83.3% 75% 100% 0%
vm2.Ulid 100% 95.8% 100% 100%
vm2.UlidFactory 100% 100% 100% 100%
UlidTool - 100%
Name Line Branch Method Full method
UlidTool 100% 100% 100% 100%
UlidToolApp 100% 100% 100% 100%

@github-actions
Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchfix/aot
Testbedubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
nanoseconds (ns)
(Result Δ%)
Upper Boundary
nanoseconds (ns)
(Limit %)
allocatedBenchmark Result
Measure (units)
(Result Δ%)
Upper Boundary
Measure (units)
(Limit %)
gen1-collectsBenchmark Result
Measure (units)
(Result Δ%)
Upper Boundary
Measure (units)
(Limit %)
gen2-collectsBenchmark Result
Measure (units)
(Result Δ%)
Upper Boundary
Measure (units)
(Limit %)
vm2.Benchmarks.Ulid.Factory_NewUlid📈 view plot
🚷 view threshold
60.20 ns
(-2.84%)Baseline: 61.96 ns
74.35 ns
(80.96%)
📈 view plot
🚷 view threshold
40.00 units
(0.00%)Baseline: 40.00 units
48.00 units
(83.33%)
📈 view plot
🚷 view threshold
0.00 units
(0.00%)Baseline: 0.00 units
0.00 units
(0.00%)
📈 view plot
🚷 view threshold
0.00 units
(0.00%)Baseline: 0.00 units
0.00 units
(0.00%)
vm2.Benchmarks.Ulid.Ulid_NewUlid📈 view plot
🚷 view threshold
60.40 ns
(-2.44%)Baseline: 61.91 ns
74.29 ns
(81.30%)
📈 view plot
🚷 view threshold
40.00 units
(0.00%)Baseline: 40.00 units
48.00 units
(83.33%)
📈 view plot
🚷 view threshold
0.00 units
(0.00%)Baseline: 0.00 units
0.00 units
(0.00%)
📈 view plot
🚷 view threshold
0.00 units
(0.00%)Baseline: 0.00 units
0.00 units
(0.00%)
vm2.Benchmarks.Ulid.Ulid_Parse_Utf16📈 view plot
🚷 view threshold
62.45 ns
(-1.01%)Baseline: 63.09 ns
75.71 ns
(82.49%)
📈 view plot
🚷 view threshold
40.00 units
(0.00%)Baseline: 40.00 units
48.00 units
(83.33%)
📈 view plot
🚷 view threshold
0.00 units
(0.00%)Baseline: 0.00 units
0.00 units
(0.00%)
📈 view plot
🚷 view threshold
0.00 units
(0.00%)Baseline: 0.00 units
0.00 units
(0.00%)
vm2.Benchmarks.Ulid.Ulid_Parse_Utf8📈 view plot
🚷 view threshold
53.57 ns
(-1.54%)Baseline: 54.41 ns
65.29 ns
(82.05%)
📈 view plot
🚷 view threshold
40.00 units
(0.00%)Baseline: 40.00 units
48.00 units
(83.33%)
📈 view plot
🚷 view threshold
0.00 units
(0.00%)Baseline: 0.00 units
0.00 units
(0.00%)
📈 view plot
🚷 view threshold
0.00 units
(0.00%)Baseline: 0.00 units
0.00 units
(0.00%)
vm2.Benchmarks.Ulid.Ulid_ToString📈 view plot
🚷 view threshold
45.18 ns
(-0.60%)Baseline: 45.45 ns
54.55 ns
(82.84%)
📈 view plot
🚷 view threshold
80.00 units
(0.00%)Baseline: 80.00 units
96.00 units
(83.33%)
📈 view plot
🚷 view threshold
0.00 units
(0.00%)Baseline: 0.00 units
0.00 units
(0.00%)
📈 view plot
🚷 view threshold
0.00 units
(0.00%)Baseline: 0.00 units
0.00 units
(0.00%)
🐰 View full continuous benchmarking report in Bencher

@vmelamed vmelamed merged commit db184cc into main May 29, 2026
14 checks passed
@vmelamed vmelamed deleted the fix/aot branch May 29, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants