Azure Search .NET SDK 抛出 InvalidOperationException SerializationBinder Newtonsoft.Json 版本高于 9.0.1

Azure Search .NET SDK throws InvalidOperationException SerializationBinder with Newtonsoft.Json version higher than 9.0.1

我收到一条错误消息 System.MissingMethodException:未找到方法:'Newtonsoft.Json.SerializationBinder' 从 Azure .NET SDK 更新 NewtonSoft.Json 到版本 10.0.3

这是 StackTrace 的一部分

at Microsoft.Azure.Search.JsonUtility.CopySettings(JsonSerializerSettings baseSettings)
   at Microsoft.Azure.Search.JsonUtility.CreateDeserializerSettings[TSearchResult,TSuggestResult,TDoc](JsonSerializerSettings baseSettings)
   at Microsoft.Azure.Search.DocumentsOperations.DeserializeForSearch[T](String payload)
   at Microsoft.Azure.Search.DocumentsOperations.<DoContinueSearchWithHttpMessagesAsync>d__21`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.DocumentsOperationsExtensions.<SearchAsync>d__17`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 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

我使用的是最新版本 Microsoft.Azure.Search 和 .Net Core

这是一个known issue。请确保您使用的是 Microsoft.Azure.Search 的 5.0.0 版(或可用的更新版本)。