Add .NET bindings - #475
Open
grinidx wants to merge 5 commits into
Open
Conversation
Adds a `protoc_builtin: csharp` entry to buf.gen.yaml alongside java and kotlin, the generated `bindings/dotnet/src/Scip.cs`, and a project that packs to the `Scip` NuGet package. protoc's C# backend emits an uncompilable `Descriptor` class (CS0542), so proto-generate renames the generated class to `SymbolDescriptor`. The Protobuf message itself is untouched.
Builds and packs bindings/dotnet with `buildDotnetModule`, pinned to the .NET 10 SDK, and asserts the project version matches cmd/scip/version.txt in the same style as the Rust, Haskell and TypeScript checks.
The PR check builds bindings/dotnet with a stock SDK and validates the package version against cmd/scip/version.txt, as the JVM bindings check does. The release workflow packs and pushes the Scip package to NuGet through `nix develop`, like the crate and Hackage jobs.
Adds bindings/dotnet/Scip.csproj to the list of files a version bump touches, and a NuGet publishing section alongside the JVM one.
`Scip.Index` is ambiguous with `System.Index` under implicit usings, so the README example aliases it. Google.Protobuf joins protobuf-java in the renovate rule that keeps the runtime in lock-step with flake.nix's protoc.
This was referenced Aug 17, 2026
Author
|
One practical note on the
The risk is low - SCIP has existed four years and nobody has taken it - but it is not zero, and this could sit for a while. Happy to do whichever suits you:
Default assumption is the first. Nothing here blocks review of the code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds .NET bindings, as discussed in #468.
bindings/had go, haskell, java, kotlin, rust and typescript, so anyone writing a .NET SCIP producer or consumer vendorsscip.protoby hand today. Sourcegraph's ownscip-dotnetdoes, and so does the tool this came out of.The three things asked for
The bindings. Package id
Scip, targetingnetstandard2.0. Generated by a newprotoc_builtin: csharpentry inbuf.gen.yaml, alongside the existingjavaandkotlinones. The generated file is committed and markedlinguist-generated, matching what the other bindings do; CI regenerates and runsgit diff --exit-code, so it cannot drift.netstandard2.0because the bindings are pure generated data types with no framework-specific surface, so it costs nothing and reaches .NET Framework 4.6.1 and above, Mono and Unity, and every modern .NET.Google.Protobufships anetstandard2.0assembly.Nix. A
dotnet-bindingscheck inchecks.nixin the same shape asgo-bindings, plus what the devShell needs.The
formattingcheck still passes with these files in place.Release automation. A
publish-dotnet-bindingsjob inrelease.yamlin the shape of the existing per-binding publish jobs, plus adotnet-bindings.yamlPR check modelled onjvm-bindings.yaml, including its validation that the version matchescmd/scip/version.txt.One wrinkle worth knowing about
protoc's C# backend emits a
Descriptorclass that does not compile: CS0542, because every generated protobuf type already carries a staticDescriptorproperty. Soproto-generaterenames the class toSymbolDescriptor.The message itself is untouched, and
SymbolDescriptor.Descriptor.FullNamestill returnsscip.Descriptor, so nothing about the wire format or the schema changes. It is also whatsourcegraph/scip-dotnetalready ships, so anyone moving between the two sees the same name.Verified against a real index
Rather than only checking it compiles, a console app consuming the packed
Scip.0.9.0.nupkgread a realscip-typescript0.4.0 index of 60,867 bytes:Re-encoding produces a byte-identical 60,867 bytes, and the reparsed index
.Equals(original).Needs something at your end
A
NUGET_API_KEYActions secret, scoped to "Push new packages and package versions". TheScipid is unregistered, so the first release creates it - worth claiming from an org account rather than a personal one if you have a preference.Nothing else: no nix, runner or branch-protection changes.
One maintenance note for whoever does the next release:
bindings/dotnet/deps.jsonmust be regenerated wheneverGoogle.Protobufmoves, in lock-step with flake.nix's protoc. The command is documented inchecks.nix, and renovate is pinned off that dependency so it cannot bump it silently.