为什么我在调用 Graph API 时会收到 NotSupportedException?

Nel*_*and 4 microsoft-graph-api

使用如下调用调用 Microsoft Graph API 后:

var driveItem = await _graphApiClient.Sites[SiteId].Drives[DriveId].Root.ItemWithPath(path)
    .Request().GetAsync();
Run Code Online (Sandbox Code Playgroud)

我得到:

System.NotSupportedException: Serialization and deserialization of 'System.Action' instances are not supported. Path: $.MoveNextAction.
 ---> System.NotSupportedException: Serialization and deserialization of 'System.Action' instances are not supported.
   at System.Text.Json.Serialization.Converters.UnsupportedTypeConverter`1.Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
   at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
   at ...
Run Code Online (Sandbox Code Playgroud)

Nel*_*and 12

检查您是否使用等待或异步处理程序调用您的方法。

我的例子:

return Ok(graphManager.GraphMethod(request));
Run Code Online (Sandbox Code Playgroud)

return Ok(graphManager.GraphMethod(request).Result);
Run Code Online (Sandbox Code Playgroud)