如何调试 System.Text.Json 反序列化器

Eti*_*and 6 .net c# .net-core system.text.json

如果使用 System.Text.Json 反序列化 JSON 数据,其中数据与目标模型不匹配,则会抛出 NotSupportedException 且不包含任何详细信息。

如果数据很复杂,则很难确定问题发生的位置。

有没有办法获得更多调试信息,或者关于哪个成员反序列化失败的一些提示?

编辑

这是一个示例命令

var result = await JsonSerializer.DeserializeAsync<ApiResponse<T>>(responseStream, OntraportSerializerOptions.Default, CancellationToken.None).ConfigureAwait(false);
Run Code Online (Sandbox Code Playgroud)

错误信息:

2[System.Int32,OntraportApi.Models.ResponseSectionFields]' on 'OntraportApi.Models.ApiResponse不支持集合类型“System.Collections.Generic.Dictionary 1[System.Collections.Generic.Dictionary`2[System.Int32,OntraportApi.Models.ResponseSectionFields]].Data”。

responseStream.Length = 18494,要我粘贴吗?