The Stack Trace Trace на json.net, который, кажется, не связан с самим вызовом HTTP, но он последовательно происходит в SendAsync < /code>.
Код: Выделить всё
System.InvalidOperationException: Could not create getter for System.Threading.ExecutionContext& Context.
ByRef return values are not supported.
at Newtonsoft.Json.Utilities.ReflectionDelegateFactory.CreateGet[T](MemberInfo memberInfo)
at Newtonsoft.Json.Serialization.ExpressionValueProvider.GetValue(Object target)
... (stack truncated)
< /code>
минимальный воспроизводимый пример < /h3>
`< /p>
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// No custom handlers / policies
using var client = new HttpClient(new HttpClientHandler());
var request = new HttpRequestMessage(
HttpMethod.Post,
"https://api.griffin.com/v0/security/message-signature/verify")
{
Content = new StringContent("{\"hello\":\"world\"}", Encoding.UTF8, "application/json")
};
// The exception is thrown here:
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
}
}
< /code>
Что я ожидал < /h3>
SendAsyncЧто на самом деле происходит
Код: Выделить всё
SendAsyncЧто я проверил
- /Httpresponsemessage < /code> Использование - ничего. /> Вопросы < /h3>
Как я могу отслеживать происхождение этого вызова сериализации из точки исключения? /> - Существуют ли известные взаимодействия, где httpclient + json.net + common telemetry (serilog, Insights, Polly и т. Д.) Может запустить этот ByRef executionContext getTer без пользовательских обработчиков? Json.net для использования во время httpclient.sendasync Когда я не сериализую запрос самостоятельно? />
среда (если полезно) < /h3>
.net/.net Core версии: < /li>
newtonsoft.json версии: < /li> os -greciots /telemetric /telemetric /telemetric /telemetrics /telemetrics /telemetrics /telemetrics. AI Sdk, Polly и т. Д.):
теги: c# httpclient .net
Подробнее здесь: https://stackoverflow.com/questions/797 ... e-getter-f
Мобильная версия