From b78330b21df8a53eee60f1b89d0cd515b90ca488 Mon Sep 17 00:00:00 2001 From: Sydney Acksman Date: Sun, 5 May 2019 13:26:12 -0500 Subject: [PATCH] Fix RepeatedExtensionValue.IsInitialized --- csharp/src/Google.Protobuf/ExtensionValue.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/csharp/src/Google.Protobuf/ExtensionValue.cs b/csharp/src/Google.Protobuf/ExtensionValue.cs index 6b224ed441..986b2fce0d 100644 --- a/csharp/src/Google.Protobuf/ExtensionValue.cs +++ b/csharp/src/Google.Protobuf/ExtensionValue.cs @@ -213,7 +213,23 @@ namespace Google.Protobuf public bool IsInitialized() { - return field.All(m => m is IMessage && (m as IMessage).IsInitialized()); + for (int i = 0; i < field.Count; i++) + { + var element = field[i]; + if (element is IMessage) + { + if (!(element as IMessage).IsInitialized()) + { + return false; + } + } + else + { + break; + } + } + + return true; } } }