Skip to content

fix(buf): generate C# service clients from aggregate template - #65

Open
mikemcdougall wants to merge 1 commit into
trunkfrom
fix/buf-gen-csharp-clients
Open

fix(buf): generate C# service clients from aggregate template#65
mikemcdougall wants to merge 1 commit into
trunkfrom
fix/buf-gen-csharp-clients

Conversation

@mikemcdougall

Copy link
Copy Markdown
Contributor

Summary

Two coupled C# code-generation defects in the canonical templates/docs, found in the round-5 release audit.

1. Aggregate buf.gen.yaml omits the grpc/csharp plugin (S2)

buf.gen.yaml:16 — the aggregate C# block listed only protocolbuffers/csharp and was missing grpc/csharp, even though its own comment asserts it "matches buf.gen.csharp.yaml and the published NuGet package." Every other language pairs its protobuf plugin with its gRPC plugin (Go, Java, Python); C# was the lone gap.

Consequence: buf generate — the exact command docs/getting-started.md Step 3 tells C# users to run — emitted message/enum types but no *ServiceClient stubs. The Step 5 sample (new FeatureService.FeatureServiceClient(channel) + QueryFeaturesAsync) would not compile against that output. The NuGet package is unaffected (it uses Grpc.Tools with GrpcServices=Both), so only the documented local-codegen C# path was broken, and CI's per-language generate job uses buf.gen.csharp.yaml — so this landed green.

Fix: add grpc/csharp:v1.81.1 (pinned to match buf.gen.csharp.yaml) to the aggregate template.

2. AGENTS.md documents a wrong/breaking C# base namespace (S2)

AGENTS.md:115 claimed generation uses "C# base namespace GeospatialGrpc". No base_namespace override is — or can be — set: managed mode derives Geospatial.V1 from the proto package, and a base_namespace that is not a prefix of that namespace makes the csharp plugin hard-fail. All real consumers (examples/dotnet/Program.cs, getting-started, the smoke test) use Geospatial.V1. A contributor trusting AGENTS.md and adding base_namespace=GeospatialGrpc would break C# generation. Corrected the text to match buf.gen.yaml's own comment.

Verification

Ran buf generate with the fixed aggregate C# block:

  • Output namespace: Geospatial.V1 (matches all consumers)
  • 14 *ServiceClient classes generated (FeatureServiceClient, FormServiceClient, etc.)

Empirically confirmed the inverse: setting base_namespace=GeospatialGrpc fails with Namespace Geospatial.V1 is not a prefix namespace of base namespace GeospatialGrpc.

Findings addressed

  • buf.gen.yaml:16 — aggregate template missing grpc/csharp plugin
  • AGENTS.md:115 — stale/incorrect C# base-namespace claim

The aggregate buf.gen.yaml C# block listed only protocolbuffers/csharp and
was missing the grpc/csharp plugin, even though its own comment claims it
"matches buf.gen.csharp.yaml". As a result  (the command
docs/getting-started.md tells C# users to run) emitted message/enum types
but no *ServiceClient stubs, so the Step 5 sample
(new FeatureService.FeatureServiceClient(channel) + QueryFeaturesAsync)
would not compile against the aggregate output. Every other language pairs
its protobuf plugin with its gRPC plugin; C# was the only gap.

Add grpc/csharp:v1.81.1 to the aggregate template (pinned to match
buf.gen.csharp.yaml) so the canonical template produces the documented
service clients. Verified: buf generate now emits namespace Geospatial.V1
plus 14 *ServiceClient classes.

Also correct AGENTS.md, which described a C# "base namespace
GeospatialGrpc". No base_namespace override is (or can be) set: managed
mode derives Geospatial.V1 from the proto package, and a base_namespace
that is not a prefix of that namespace makes the csharp plugin hard-fail.
The stale claim would lead a contributor to add base_namespace=GeospatialGrpc
and break C# generation.

Findings: buf.gen.yaml:16 (missing grpc/csharp), AGENTS.md:115 (wrong namespace).
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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