From 421040b32b002828f0a37404b62e1454fb610761 Mon Sep 17 00:00:00 2001
From: Protobuf Team Bot <protobuf-github-bot@google.com>
Date: Thu, 29 Feb 2024 10:03:19 -0800
Subject: [PATCH] Enable Editions in the C# generator.

PiperOrigin-RevId: 611508658
---
 src/google/protobuf/compiler/csharp/csharp_generator.cc | 3 ++-
 src/google/protobuf/compiler/csharp/csharp_generator.h  | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/google/protobuf/compiler/csharp/csharp_generator.cc b/src/google/protobuf/compiler/csharp/csharp_generator.cc
index 20777529a5607..0781cf810beb0 100644
--- a/src/google/protobuf/compiler/csharp/csharp_generator.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_generator.cc
@@ -28,7 +28,8 @@ Generator::Generator() {}
 Generator::~Generator() {}
 
 uint64_t Generator::GetSupportedFeatures() const {
-  return CodeGenerator::Feature::FEATURE_PROTO3_OPTIONAL;
+  return CodeGenerator::Feature::FEATURE_PROTO3_OPTIONAL |
+         CodeGenerator::Feature::FEATURE_SUPPORTS_EDITIONS;
 }
 
 void GenerateFile(const FileDescriptor* file, io::Printer* printer,
diff --git a/src/google/protobuf/compiler/csharp/csharp_generator.h b/src/google/protobuf/compiler/csharp/csharp_generator.h
index cb955f3b78a4c..05ac16fed2c37 100644
--- a/src/google/protobuf/compiler/csharp/csharp_generator.h
+++ b/src/google/protobuf/compiler/csharp/csharp_generator.h
@@ -35,6 +35,8 @@ class PROTOC_EXPORT Generator : public CodeGenerator {
     GeneratorContext* generator_context,
     std::string* error) const override;
   uint64_t GetSupportedFeatures() const override;
+  Edition GetMinimumEdition() const override { return Edition::EDITION_PROTO2; }
+  Edition GetMaximumEdition() const override { return Edition::EDITION_2023; }
   using CodeGenerator::GetEdition;
 };