Skip to content

setting C# option base_namespace to an empty string results in inconsistent behavior #34113

@felschr

Description

@felschr

What version of gRPC and what language are you using?

gRPC 1.57.0, C#

What operating system (Linux, Windows,...) and version?

NixOS 23.05 (Linux)

What runtime / compiler are you using (e.g. python version or version of gcc)

gcc (GCC) 12.3.0

What did you do?

I invoked protoc with grpc_csharp_plugin & --grpc_opt=base_namespace= option:

protoc --plugin=protoc-gen-grpc=grpc_csharp_plugin \
    --grpc_out=OUT_DIR \
    --grpc_opt=base_namespace= \
    -I INCLUDE_DIR foo.proto

What did you expect to see?

Generated C# files being written in a directory structure based on the namespace.
Which is the same behavior that protoc has for its equivalent csharp_opt:
https://github.com/protocolbuffers/protobuf/blob/1bfcedaf1280923f36e52a6fa0a5645ab63568f0/src/google/protobuf/compiler/csharp/csharp_options.h#L63-L67

What did you see instead?

All generated C# files being written to the root directory, like base_namespace wasn't set at all.

Anything else we should know about your project / environment?

I've originally reported this issue here: #33535 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions