(C#) Generated code should avoid extra copies of request data
Currently the C# code generated by AutoRest serializes HTTP request payloads like this:
// Serialize Request
string _requestContent = SafeJsonConvert.SerializeObject(dataSource, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
This results in an unnecessary copy of the data since the string representation of the JSON is needed to initialize StringContent. It would create less memory pressure for large payloads if we use ObjectContent or PushStreamContent instead (or their .NET core-compatible equivalents, or even a custom implementation if these classes aren't available on all .NET targets yet).
Howdy!
In our planning for driving towards a stable '1.0' release, I'm marking this issue as 'deferred' :zzz: and we're going to review it during the post-1.0 planning cycle.
It's not to say that we're not going to work on it, or that this isn't not important, but at the moment, we're picking and choosing the stuff we must do before 1.0. :horse_racing: :horse_racing: :horse_racing:
We'll make sure we pick this back up at that point. :tada: