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

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

merged 2 commits into from
Jul 24, 2019

Conversation

arv100kri
Copy link
Member

In the DoIndexAsync method, when the response contains partial success/failure - an IndexBatchException object is constructed, whose request and response wrapper objects are assigned to the result from the underlying proxy's operation.

The request wrapper object attempts to re-read the request content from the underlying proxy's result - this results in the ObjectDisposedException when the target framework is .NET Framework 4.x

This is because the HttpClient in the .NET framework, automatically disposes the HttpContent once the request is actually sent, whereas the HttpClient in .NET Core no longer disposes the HttpContent

This pull request adds conditional logic to detect the target framework, and re-serializes the request payload in case the framework is .NET Framework 4.x

Fixes #6910

FYI: @weshaggard

@weshaggard weshaggard merged commit 4839ca2 into Azure:master Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Azure search - ObjectDisposedException thrown instead of IndexBatchException when merging index batch
3 participants