简体   繁体   English

Microsoft.Graph collections DLL 内的反序列化

[英]Microsoft.Graph collections deserialization within DLL

I have strange problem with receiving collection from Microsoft Graph.我从 Microsoft Graph 接收集合时遇到奇怪的问题。 My goal is to create add-in as DLL for another system, which process MS Graph collections.我的目标是为另一个系统创建插件作为 DLL,该系统处理 MS Graph collections。 I use code as follow:我使用如下代码:

var drives = graphClient.Sites[siteId].Drives.Request().GetAsync().Result;
return drives.Count;

In Visual Studio 2019, within Unit Test Project, it work fine without errors.在 Visual Studio 2019 中,在单元测试项目中,它工作正常,没有错误。

Problem appears, when I use the DLL in destination system.当我在目标系统中使用 DLL 时出现问题。 There the same code throw following exception:有相同的代码抛出以下异常:

-2146233088 | -2146233088 | Could not create an instance of type Microsoft.Graph.ISiteDrivesCollectionPage.无法创建 Microsoft.Graph.ISiteDrivesCollectionPage 类型的实例。 Type is an interface or abstract class and cannot be instantiated类型为接口或抽象 class 且不能实例化

Have you any idea, why Graph SDK as Add-in doesn't automaticly deserialize received objects?您知道吗,为什么 Graph SDK as Add-in 不会自动反序列化接收到的对象? It work fine if receive one class, not collection.如果收到一个 class,它工作正常,而不是收集。

Work-around is by use HttpRequestMessage / HttpResponseMessage, but it's so friendly as above.解决方法是使用 HttpRequestMessage / HttpResponseMessage,但它和上面一样友好。

I will be grateful for your help我会感谢你的帮助

Sounds like a dependency(.net framework, libraries) is missing at the destination system.听起来目标系统缺少依赖项(.net 框架、库)。 Make sure it has the necessary dependencies installed.确保它已安装必要的依赖项。 Always use the latest NuGet package, make sure the dependencies exist in the destination system.始终使用最新的 NuGet package,确保目标系统中存在依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM