You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Using Net Framework 4.7.1, when merging documents with key not present in azure search index, a ObjectDisposedException is thrown instead of IndexBatchException.
Exception or Stack Trace
Cannot access a disposed object. Object name: 'System.Net.Http.StringContent'
at System.Net.Http.HttpContent.CheckDisposed()
at System.Net.Http.HttpContent.ReadAsStringAsync()
at Microsoft.Azure.Search.DocumentsOperations.d__19`1.MoveNext()
To Reproduce
Steps to reproduce the behavior:
Create a batch of document complying to an azure search index model but with the key missing in index
Merge the batch to the index and catch the exception thrown
The exception thrown should be ObjectDisposedException instead of IndexBatchException
Code Snippet
var searchClient = new SearchServiceClient(searchName, new SearchCredentials(searchKey));
var documents = new Model[]
{
new Model
{
Id = "abcd",
Description = "Key Id not present in index"
},
};
var batch = IndexBatch.Merge(documents);
try
{
searchClient.Indexes.GetClient(indexName).Documents.Index(batch);
Console.WriteLine("\t> Batch successfully run");
}
catch (IndexBatchException e)
{
Console.WriteLine("\t> Batch failed with expected exception");
}
catch (ObjectDisposedException ex)
{
Console.WriteLine("\t> Batch failed with unexpected exception");
}
Expected behavior
We expect the IndexBatchException to be thrown instead of ObjectDisposedException
@cwi3310 - Thanks for reporting the bug, I've checked in a pull request that will fix this.
I'll update this thread, sometime next week once we make a release of a new nuget package.
Describe the bug
Using Net Framework 4.7.1, when merging documents with key not present in azure search index, a ObjectDisposedException is thrown instead of IndexBatchException.
Exception or Stack Trace
Cannot access a disposed object. Object name: 'System.Net.Http.StringContent'
at System.Net.Http.HttpContent.CheckDisposed()
at System.Net.Http.HttpContent.ReadAsStringAsync()
at Microsoft.Azure.Search.DocumentsOperations.d__19`1.MoveNext()
To Reproduce
Steps to reproduce the behavior:
The exception thrown should be ObjectDisposedException instead of IndexBatchException
Code Snippet
Expected behavior
We expect the IndexBatchException to be thrown instead of ObjectDisposedException
Setup:
.Net Framework 4.7.1
Additional context
The problem doesn't seems to appears in .Net Core.
The text was updated successfully, but these errors were encountered: