【发布时间】:2022-01-18 16:09:14
【问题描述】:
我使用 openapi extension 运行 Azure 函数。
为了在 openapi 定义中获取正确的可为空值,我使用了 DTO 的 DisallowNull 属性。
public record MyObject(
[property: JsonProperty(Required = Required.DisallowNull)]
string ContinuationToken);
我有一个错误,即一个属性有 DisallowNull,但在某些情况下可能为 null。
在了解我重现的错误后,我在本地收到了一条有用的消息:
[2021-12-15T12:41:06.365Z] Newtonsoft.Json: Cannot write a null value for property 'continuationToken'. Property requires a non-null value. Path ''.
这样,错误很快得到修复,但是当我查看 Application Insights 日志时,我看不到任何错误。请求中只有 Response code 500 表示错误。
是否有可能在应用程序洞察日志中获取 Azure Functions 的序列化错误?
【问题讨论】:
标签: json.net azure-functions azure-application-insights