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
Calling SearchIndexClient.GetIndexNames throws an ArgumentNullException with the message "Fields cannot be null. To clear values, call Clear. (Parameter 'value')".
Expected behavior
The method should return the list of index names.
Actual behavior (include Exception or Stack Trace)
Calling SearchIndexClient.GetIndexNames throws an ArgumentNullException with the message "Fields cannot be null. To clear values, call Clear. (Parameter 'value')".
The reason this is happening is that GetIndexNames calls IndexesClient.List with Constants.NameKey, which results in a JSON document missing all properties except for the name of the index. Attempting to deserialize this then fails because fields are required, and are missing (despite definitely existing on the actual indexes) in the JSON getting passed in.
The implementation of GetIndexNames and GetIndexNamesAsync should either use a different new method on the IndexerRestClient that doesn't attempt to deserialize indexes but just extracts the name that are needed, or should Constants.All before it does the deserialization like GetIndexes does.
Workaround
Use SearchIndexClient.GetIndexes(serviceName, credentials).Select(idx => idx.Name) instead.
To Reproduce
Call SearchIndexClient.GetIndexNames.
Environment:
Name and version of the Library package used: Azure.Search.Documents 11.1.1
Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): .NET Core 3.1
IDE and version : Visual Studio 16.8.0 Preview 3.2
The text was updated successfully, but these errors were encountered:
ghost
added
the
needs-triage
Workflow: This is a new issue that needs to be triaged to the appropriate team.
label
Sep 30, 2020
Since we're close to code complete and I have another issue I'm working on, I'm moving this to November. If we need this for October 6th, please let me know ASAP.
heaths
added a commit
to heaths/azure-sdk-for-net
that referenced
this issue
Oct 14, 2020
Describe the bug
Calling
SearchIndexClient.GetIndexNames
throws anArgumentNullException
with the message "Fields cannot be null. To clear values, call Clear. (Parameter 'value')".Expected behavior
The method should return the list of index names.
Actual behavior (include Exception or Stack Trace)
Calling
SearchIndexClient.GetIndexNames
throws anArgumentNullException
with the message "Fields cannot be null. To clear values, call Clear. (Parameter 'value')".The reason this is happening is that
GetIndexNames
callsIndexesClient.List
withConstants.NameKey
, which results in a JSON document missing all properties except for the name of the index. Attempting to deserialize this then fails becausefields
are required, and are missing (despite definitely existing on the actual indexes) in the JSON getting passed in.The implementation of
GetIndexNames
andGetIndexNamesAsync
should either use a different new method on theIndexerRestClient
that doesn't attempt to deserialize indexes but just extracts the name that are needed, or should Constants.All before it does the deserialization likeGetIndexes
does.Workaround
Use
SearchIndexClient.GetIndexes(serviceName, credentials).Select(idx => idx.Name)
instead.To Reproduce
Call
SearchIndexClient.GetIndexNames
.Environment:
dotnet --info
output for .NET Core projects): .NET Core 3.1The text was updated successfully, but these errors were encountered: