diff --git a/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc b/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc index 423033e101..56a7ab232e 100644 --- a/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc +++ b/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc @@ -54,7 +54,13 @@ void WriteDocCommentBodyImpl(io::Printer* printer, SourceLocation location) { printer->Print("///\n"); } last_was_empty = false; - printer->Print("///$line$\n", "line", *it); + // If the comment has an extra slash at the start then this can cause the C# compiler + // to complain when generating the XML documentation + // Issue https://github.com/grpc/grpc/issues/35905 + if (line[0] == '/') { + line.replace(0,1,"/"); + } + printer->Print("///$line$\n", "line", line); } } printer->Print("/// \n");