Google 日历 API - 机器人框架:"CalendarService is not marked as serializable"

Google Calendar API - Bot Framework: "CalendarService is not marked as serializable"

我是 C# 编程的新手,正在尝试通过聊天机器人管理 google 日历。

我基于 Microsoft Bot Framework 模板使用 Visual Studio 在 C# 中构建了一个 ChatBot,它 有效

我按照这个 https://developers.google.com/google-apps/calendar/quickstart/dotnet 指南通过 Visual C# 控制台应用程序项目管理日历,有效

问题是,当我尝试将日历 link 带回 Bot 项目时(遵循与应用程序项目相同的过程),我遇到了以下问题:

Exception: The type 'Google.Apis.Calendar.v3.CalendarService' in the assembly 'Google.Apis.Calendar.v3, Version = 1.30.0.1032, Culture = neutral, PublicKeyToken = 4b01fa6e34db77ab' is not marked as serializable.

在我看来,图书馆有问题,但我想不出如何摆脱它。一些想法?非常感谢

我一个人解决了。问题是我创建了一次 CalendarServices,所以当我调用它们时,它们产生了序列化问题。现在,每次我需要使用它们时,我都会重新创建,所以问题不会出现。