Azure Search .NET SDK throws InvalidOperationException with SerializationBinder
See original GitHub issueAn exception thrown when entering operations with index (Exists, Create, Delete…). Encountered with .NET Core SDK 1.0.4 on Mac OSX 10.12.4
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Cannot get SerializationBinder because an ISerializationBinder was previously set.
at Newtonsoft.Json.JsonSerializer.get_Binder()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Rest.Azure.JsonSerializerExtensions.WithoutConverter(JsonSerializer serializer, JsonConverter converterToExclude)
at Microsoft.Rest.Azure.CloudErrorJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)
at Microsoft.Azure.Search.IndexesOperations.<GetWithHttpMessagesAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Search.ExistsHelper.<ExistsFromGetResponse>d__0`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Search.IndexesOperationsExtensions.<ExistsAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Search.IndexesOperationsExtensions.Exists(IIndexesOperations operations, String indexName, SearchRequestOptions searchRequestOptions)
Issue Analytics
- State:
- Created 6 years ago
- Comments:34 (18 by maintainers)
Top Results From Across the Web
Azure Search .Net SDK throws InvalidOperationException ...
This was caused by a known compatibility issue that many Azure SDKs have with JSON.NET version 10. The details are here and here....
Read more >Azure Search .NET SDK throws InvalidOperationException ...
Coding example for the question Azure Search .NET SDK throws InvalidOperationException SerializationBinder with Newtonsoft.Json version higher than 9.0.1.
Read more >Use Azure.Search.Documents (v11) in .NET
Learn how to create and manage search objects in a .NET application using C# and the Azure.Search.Documents (v11) client library.
Read more >Untitled
... Added SerializationBinder properties to ... ISerializationBinder Interface - Newtonsoft Azure Search .NET SDK throws InvalidOperationException with .
Read more >Azure Cognitive Search client library for .NET
Azure Cognitive Search APIs simplify query construction, faceted navigation, filters (including geo-spatial search), synonym mapping, typeahead queries, and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@isaacabraham Good point.
FYI @shahabhijeet @markcowl We found an incompatibility between JSON.NET 11 beta and
Microsoft.Azure.Search
. Specifically, theJsonSerializerSettings.Binder
property, whichMicrosoft.Azure.Search
currently references, has been deleted (it was marked as deprecated in JSON.NET 10). I don’t know if this change will affectClientRuntime
or not, but I thought I should give you folks a heads up. Do you see any harm in setting the max version ofNewtonsoft.Json
to 10 in AzSdk.reference.props?I had same issue with .Net core. It solved just after degrading newtonsoft.Json to version 10.2. I guess with any of 10 versions it should work