Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Azure Search] Prevent ObjectDisposedException when Indexing using "Merge" operation #7011

Merged
merged 2 commits into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,15 @@ await Client.DocumentsProxy.IndexWithHttpMessagesAsync(
HttpRequestMessage httpRequest = result.Request;
HttpResponseMessage httpResponse = result.Response;

// NOTE: It is not possible to read the http request's string content property here,
// via .NET framework's HttpClient, as the Content gets disposed as soon as the request is sent.
// Thus the batch is re-serialized, which is what happens in the IndexWithHttpMessagesAsync() method
// In .NET Core, the Content doesn't get disposed, so it's safe to read the string content here.
#if FullNetFx
string requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(batch, jsonSettings);
#else
string requestContent = await httpRequest.Content.ReadAsStringAsync().ConfigureAwait(false);
#endif
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

var exception =
Expand Down
Loading