Skip to content

Add custom repeated parser support - #205

Merged
dameng324 merged 1 commit into
mainfrom
feature/custom-repeated-parsers
Aug 2, 2026
Merged

Add custom repeated parser support#205
dameng324 merged 1 commit into
mainfrom
feature/custom-repeated-parsers

Conversation

@dameng324

Copy link
Copy Markdown
Owner

Summary

  • Add ProtoRepeatedParserType and ProtoRepeatedParserTypeMap for custom IEnumerable<T> repeated-field adapters.
  • Generate reader/writer construction with the element parser, field tag, and fixed item size.
  • Document the feature in English and Chinese, and add public API baselines.
  • Cover type, member, contract, and assembly mappings, including packed fixed-size primitives and message elements.

Why

Custom collection types previously fell through to the built-in collection parser selection and could not provide their own repeated reader/writer pair while preserving protobuf repeated wire semantics.

Validation

  • dotnet test LightProto.slnx --no-restore --configuration Release -p:PublishAot=false --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml
  • dotnet tool run csharpier -- check .

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 24 complexity · 0 duplication

Metric Results
Complexity 24
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@dameng324
dameng324 force-pushed the feature/custom-repeated-parsers branch from 34c52d9 to 13c9113 Compare August 2, 2026 09:29
@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.55%. Comparing base (7a915ec) to head (13c9113).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #205      +/-   ##
==========================================
+ Coverage   95.52%   95.55%   +0.02%     
==========================================
  Files         127      127              
  Lines        3665     3665              
  Branches      518      518              
==========================================
+ Hits         3501     3502       +1     
  Misses         90       90              
+ Partials       74       73       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.302
  [Host]    : .NET 8.0.29 (8.0.29, 8.0.2926.32403), X64 RyuJIT x86-64-v3
  .NET 10.0 : .NET 10.0.10 (10.0.10, 10.0.1026.32716), X64 RyuJIT x86-64-v3
  .NET 8.0  : .NET 8.0.29 (8.0.29, 8.0.2926.32403), X64 RyuJIT x86-64-v3
  .NET 9.0  : .NET 9.0.18 (9.0.18, 9.0.1826.31522), X64 RyuJIT x86-64-v3


Method Job Runtime Mean Error StdDev Ratio Allocated Alloc Ratio
Deserialize_ProtoBuf_net .NET 10.0 .NET 10.0 749.2 μs 2.16 μs 2.02 μs 1.31 562 KB 0.98
Deserialize_GoogleProtoBuf .NET 10.0 .NET 10.0 639.3 μs 2.16 μs 1.81 μs 1.12 648.7 KB 1.13
Deserialize_LightProto .NET 10.0 .NET 10.0 569.8 μs 3.28 μs 3.06 μs 1.00 574.8 KB 1.00
Deserialize_ProtoBuf_net .NET 8.0 .NET 8.0 894.6 μs 2.83 μs 2.65 μs 1.42 562 KB 0.98
Deserialize_GoogleProtoBuf .NET 8.0 .NET 8.0 811.8 μs 2.68 μs 2.24 μs 1.29 648.7 KB 1.13
Deserialize_LightProto .NET 8.0 .NET 8.0 631.4 μs 1.96 μs 1.53 μs 1.00 574.8 KB 1.00
Deserialize_ProtoBuf_net .NET 9.0 .NET 9.0 796.2 μs 3.72 μs 3.30 μs 1.37 562 KB 0.98
Deserialize_GoogleProtoBuf .NET 9.0 .NET 9.0 695.2 μs 1.94 μs 1.62 μs 1.19 648.7 KB 1.13
Deserialize_LightProto .NET 9.0 .NET 9.0 582.5 μs 2.38 μs 2.11 μs 1.00 574.8 KB 1.00

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.302
  [Host]    : .NET 8.0.29 (8.0.29, 8.0.2926.32403), X64 RyuJIT x86-64-v3
  .NET 10.0 : .NET 10.0.10 (10.0.10, 10.0.1026.32716), X64 RyuJIT x86-64-v3
  .NET 8.0  : .NET 8.0.29 (8.0.29, 8.0.2926.32403), X64 RyuJIT x86-64-v3
  .NET 9.0  : .NET 9.0.18 (9.0.18, 9.0.1826.31522), X64 RyuJIT x86-64-v3


Method Job Runtime Mean Error StdDev Ratio Allocated Alloc Ratio
Serialize_ProtoBuf_net .NET 10.0 .NET 10.0 916.8 μs 1.41 μs 1.18 μs 1.31 526.41 KB 1.03
Serialize_GoogleProtoBuf .NET 10.0 .NET 10.0 792.0 μs 4.21 μs 3.74 μs 1.13 512.95 KB 1.00
Serialize_LightProto .NET 10.0 .NET 10.0 701.8 μs 2.36 μs 2.09 μs 1.00 512.92 KB 1.00
Serialize_ProtoBuf_net .NET 8.0 .NET 8.0 1,023.3 μs 3.68 μs 3.26 μs 1.31 526.4 KB 1.03
Serialize_GoogleProtoBuf .NET 8.0 .NET 8.0 804.5 μs 2.45 μs 2.18 μs 1.03 512.95 KB 1.00
Serialize_LightProto .NET 8.0 .NET 8.0 778.4 μs 1.86 μs 1.65 μs 1.00 512.92 KB 1.00
Serialize_ProtoBuf_net .NET 9.0 .NET 9.0 973.8 μs 3.05 μs 2.70 μs 1.30 526.4 KB 1.03
Serialize_GoogleProtoBuf .NET 9.0 .NET 9.0 802.3 μs 2.60 μs 2.43 μs 1.07 512.95 KB 1.00
Serialize_LightProto .NET 9.0 .NET 9.0 750.1 μs 2.38 μs 1.98 μs 1.00 512.92 KB 1.00

@dameng324
dameng324 marked this pull request as ready for review August 2, 2026 09:48
@dameng324
dameng324 merged commit 5142d3f into main Aug 2, 2026
8 checks passed
@dameng324
dameng324 deleted the feature/custom-repeated-parsers branch August 2, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant