Swap registry from input when merging from existing input

pull/7246/head
Sydney Acksman 5 years ago
parent c798ba18a9
commit ca123ec40e
  1. 3
      csharp/src/Google.Protobuf/MessageParser.cs

@ -159,14 +159,17 @@ namespace Google.Protobuf
internal void MergeFrom(IMessage message, CodedInputStream codedInput)
{
bool originalDiscard = codedInput.DiscardUnknownFields;
ExtensionRegistry originalRegistry = codedInput.ExtensionRegistry;
try
{
codedInput.DiscardUnknownFields = DiscardUnknownFields;
codedInput.ExtensionRegistry = Extensions;
message.MergeFrom(codedInput);
}
finally
{
codedInput.DiscardUnknownFields = originalDiscard;
codedInput.ExtensionRegistry = originalRegistry;
}
}

Loading…
Cancel
Save