title: Error flushing XmlSerializer buffer when sending soap request (The archive entry was compressed using an unsupported compression method.)
body: <p>I'm getting an error when attempting to send a request to a ubiquitous peer-to-peer payments platform from .NET Core 3.1. The code is pretty standard for auto-generated SOAP, but here is the auto-generated model that I'm trying to serilaize:</p>
  <pre><code>    [System.CodeDom.Compiler.GeneratedCodeAttribute(&quot;Microsoft.Tools.ServiceModel.Svcutil&quot;, &quot;2.0.2&quot;)]
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace=&quot;&lt;redacted&gt;&quot;)]
      public partial class EbMtvnSvcReq
      {
          
          private MtvnSvcVerType mtvnSvcVerField;
          
          private string msgUUIDField;
          
          private PrcsParmsType prcsParmsField;
          
          private ServiceRequestType[] svcField;
          
          /// &lt;remarks/&gt;
          [System.Xml.Serialization.XmlElementAttribute(Order=0)]
          public MtvnSvcVerType MtvnSvcVer
          {
              get
              {
                  return this.mtvnSvcVerField;
              }
              set
              {
                  this.mtvnSvcVerField = value;
              }
          }
          
          /// &lt;remarks/&gt;
          [System.Xml.Serialization.XmlElementAttribute(Order=1)]
          public string MsgUUID
          {
              get
              {
                  return this.msgUUIDField;
              }
              set
              {
                  this.msgUUIDField = value;
              }
          }
          
          /// &lt;remarks/&gt;
          [System.Xml.Serialization.XmlElementAttribute(Order=2)]
          public PrcsParmsType PrcsParms
          {
              get
              {
                  return this.prcsParmsField;
              }
              set
              {
                  this.prcsParmsField = value;
              }
          }
          
          /// &lt;remarks/&gt;
          [System.Xml.Serialization.XmlElementAttribute(&quot;Svc&quot;, Order=3)]
          public ServiceRequestType[] Svc
          {
              get
              {
                  return this.svcField;
              }
              set
              {
                  this.svcField = value;
              }
          }
      }
  </code></pre>
  <p>Exception thrown:</p>
  <pre><code>System.Exception : The archive entry was compressed using an unsupported compression method.    at System.IO.Compression.Inflater.Inflate(FlushCode flushCode) at System.IO.Compression.Inflater.Inflate(FlushCode flushCode) in /_/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Inflater.cs:line 300
     at System.IO.Compression.Inflater.ReadInflateOutput(Byte* bufPtr, Int32 length, FlushCode flushCode, Int32&amp; bytesRead) in /_/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Inflater.cs:line 266
     at System.IO.Compression.Inflater.ReadOutput(Byte* bufPtr, Int32 length, Int32&amp; bytesRead) in /_/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Inflater.cs:line 122
     at System.IO.Compression.Inflater.InflateVerified(Byte* bufPtr, Int32 length) in /_/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Inflater.cs:line 92
     at System.IO.Compression.DeflateStream.&lt;FinishReadAsyncMemory&gt;d__54.MoveNext() in /_/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs:line 506
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 180
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 151
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 369
     at System.ServiceModel.Channels.HttpResponseMessageHelper.&lt;GetStreamAsync&gt;d__17.MoveNext() in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/HttpResponseMessageHelper.cs:line 316
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 180
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 151
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 369
     at System.ServiceModel.Channels.HttpResponseMessageHelper.&lt;ReadChunkedBufferedMessageAsync&gt;d__12.MoveNext() in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/HttpResponseMessageHelper.cs:line 190
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 180
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 151
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 369
     at System.ServiceModel.Channels.HttpResponseMessageHelper.&lt;ParseIncomingResponse&gt;d__7.MoveNext() in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/HttpResponseMessageHelper.cs:line 58
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 180
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 151
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 369
     at System.ServiceModel.Channels.HttpChannelFactory`1.HttpClientRequestChannel.HttpClientChannelAsyncRequest.&lt;ReceiveReplyAsync&gt;d__17.MoveNext() in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/HttpChannelFactory.cs:line 1098
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 180
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 151
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 369
     at System.ServiceModel.Channels.RequestChannel.&lt;RequestAsync&gt;d__33.MoveNext() in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/RequestChannel.cs:line 280
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 180
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 151
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 369
     at System.ServiceModel.Channels.RequestChannel.&lt;RequestAsyncInternal&gt;d__32.MoveNext() in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/RequestChannel.cs:line 239
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 180
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 151
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 369
     at System.Runtime.TaskHelpers.WaitForCompletionNoSpin[TResult](Task`1 task) in /_/src/System.Private.ServiceModel/src/Internals/System/Runtime/TaskHelpers.cs:line 282
     at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/RequestChannel.cs:line 228
     at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Dispatcher/RequestChannelBinder.cs:line 107
     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannel.cs:line 758
     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannel.cs:line 715
     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(MethodCall methodCall, ProxyOperationRuntime operation) in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannelProxy.cs:line 372
     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod, Object[] args) in /_/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannelProxy.cs:line 144
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63
     at System.Reflection.DispatchProxyGenerator.Invoke(Object[] args) in /_/src/System.Reflection.DispatchProxy/src/System/Reflection/DispatchProxyGenerator.cs:line 162
     at generatedProxy_1.SendMessage(SendMessageRequest )
     at &lt;my code&gt;
  </code></pre>
  <p>I followed the internal code and it seems to fail trying to flush the buffer.</p>
  <p>Does anyone have any insight into this?</p>