Skip to content

Can't create a full protoc plugin in C# #3487

@vbfox

Description

@vbfox

plugin.proto describe the messages to interact with protoc as a plugin but the feature doesn't seem to be fully accessible from C#.

Here are the steps I tried:

  1. Using the file directly: Impossible, C# doesn't support proto2

  2. Using the file converted to proto3: Doesn't work as it tries to reference global::Google.Protobuf.Reflection.FileDescriptorProto that isn't accessible.

  3. Converting descriptor.proto and compiling it too: Descriptor.cs doesn't build as it reference internals that aren't accessible like CustomOptions.Empty (protoc does special generation when it see Descriptor.proto)

  4. Avoid protoc special casing (Changing the folder of descriptor.proto): Now it works and writing a basic plugin is possible. But we lost the magic introduced in Low-level support for custom options in C# #2317 so custom options aren't usable at all (And can't be hacked around as it relies on extensions and they aren't supported).

I don't see any way to make it work with google version of C#/protobuf 😢 but maybe i'm missing something ?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions