From 299c78612d6d025b9c36fd7205064d0fc7309baf Mon Sep 17 00:00:00 2001 From: tony newell Date: Mon, 26 Feb 2024 10:38:38 +0000 Subject: [PATCH] Fix csharp doc commments --- src/google/protobuf/compiler/csharp/csharp_doc_comment.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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");