question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUERY] Search: SearchClient.Search Value cannot be null. (Parameter 's')

See original GitHub issue

Query/Question SearchClient.Search sometimes randomly fails with a very unclear error message. Could you give some guidance what could be the problem and how it could be resolved? Retrying the same query, does not replicate the issue 😦 Error: System.ArgumentNullException: Value cannot be null. (Parameter 's') at Azure.Search.Documents.SearchDateTimeConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase) at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken) at Azure.Search.Documents.Models.SearchResult`1.DeserializeAsync(JsonElement element, ObjectSerializer serializer, JsonSerializerOptions options, Boolean async, CancellationToken cancellationToken) at Azure.Search.Documents.Models.SearchResults`1.DeserializeAsync(Stream json, ObjectSerializer serializer, Boolean async, CancellationToken cancellationToken) at Azure.Search.Documents.SearchClient.SearchInternal[T](SearchOptions options, String operationName, Boolean async, CancellationToken cancellationToken) Environment:

  • Azure.Search.Documents v11
  • .NET SDK 5.0.200-preview.20614.14
  • IDE and version : Visual Studio Version 16.9.0 Preview 3.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Mohit-Chakrabortycommented, Jul 12, 2021

Thanks for the update @Valdeminas. And thanks @lucasroccoCM for sharing your solution. It will help future users who find this discussion.

1reaction
ghostcommented, Jul 12, 2021

Hi guys! How are you? I received the same problem described above, and I solved this turning my .NET Class property into Datetime? “Nullable” because, some indexes has null date value. { “@search.score”: 6.1858664, “id”: “5326”, “title”: “CALENDÁRIO ACADÊMICO 2021.1 EAD (5).pdf”, “content”: “Calendário Acadêmico 21.1 EAD atualizado em 10/06”, “date”: null, “url”: null },

///

/// Data do item indexado /// [JsonPropertyName(“date”)] [SearchableField(IsFilterable = true, IsSortable = true)] public DateTime? Date { get; set; }

I hope this helped someone. My best regards, Lucas Rocco

Read more comments on GitHub >

github_iconTop Results From Across the Web

"SearchAsync" InvalidCastException Null object cannot be ...
I use Azure search and a field in the search index can be null. ... var result = await searchIndexClient.Documents.SearchAsync<SearchEntity>(query ...
Read more >
Indexer errors and warnings - Azure Cognitive Search
ArgumentNullException : Value cannot be null. Parameter name: source at System.Linq.Enumerable.All[TSource](IEnumerable 1 source, ...
Read more >
Use Azure.Search.Documents (v11) in .NET
Running the search is done using the SearchClient. Search method. For each query, pass the search text to use as a string (or...
Read more >
How to resolve Value cannot be null. Parameter name
Error message clearly says that source parameter is null . Source is the enumerable you are enumerating. In your case it is ListMetadataKor ......
Read more >
Value cannot be null. Parameter name: Data Source
Hi everyone,. I'm getting the following error, when I try to access a PowerBI-Dataset from a datahub: The value cannot be NULL. Parameter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found