从 YouTube api 构造 PlayListMember 对象时出错 - C# ok F# 错误

发布于 2024-11-18 18:36:35 字数 2706 浏览 5 评论 0原文

我使用 http 中的 .NET SDK ://code.google.com/p/google-gdata/downloads/detail?name=YouTube_SDK_1.8.0.0.msi

在 F# 交互式版本 4.0.40219.1 中我只是尝试创建 PlayListMember 的新对象,但出现对象引用错误:

#r @"C:\Program Files (x86)\Google\Google YouTube SDK for .NET\Redist\Google.GData.Client.dll";;
#r @"C:\Program Files (x86)\Google\Google YouTube SDK for .NET\Redist\Google.GData.Extensions.dll";;
#r @"C:\Program Files (x86)\Google\Google YouTube SDK for .NET\Redist\Google.GData.YouTube.dll";;

open Google.GData.Client;;
open Google.GData.Extensions;;
open Google.GData.YouTube;;
open Google.YouTube;;

let pmm = new PlayListMember();;

error FS0193: internal error: Object reference not set to an instance of an object.

如果我在 C# 或 F# 控制台应用程序中执行等效操作,则没有问题。因此,从 F# 交互中使用它似乎存在一些问题。

我还可以在 F# 中创建一个播放列表,并使用 api 在 YouTube 上成功创建该列表。但简单地创建一个新的 PlayListMember 对象会失败。

我该如何调试这个问题?

更新 1

从此处下载了 GData SDK,其中还包括 YouTube SDK http://code.google.com/p/google-gdata/downloads/detail?name=Google_Data_API_Setup_1.8.0.0.msi&can=2&q=

尝试了上述方法使用新程序集:

#r @"C:\Program Files (x86)\Google\Google Data API SDK\Redist\Google.GData.Client.dll";;
#r @"C:\Program Files (x86)\Google\Google Data API SDK\Redist\Google.GData.Extensions.dll";;
#r @"C:\Program Files (x86)\Google\Google Data API SDK\Redist\Google.GData.YouTube.dll";;

open Google.GData.Client;;
open Google.GData.Extensions;;
open Google.GData.YouTube;;
open Google.YouTube;;

let pm = new PlayListMember();;

error FS0193: API restriction: The assembly 'file:///C:\Program Files (x86)\Google\Google YouTube SDK for .NET\Redist\Google.GData.YouTube.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.

完全重新启动并仅使用 F# 交互打开 VS2010 后会出现此错误。我不确定当引用的是 Google Data API SDK 时,Google YouTube SDK for .NET 中的程序集是如何加载的。

更新 2

http://code 获取最新代码.google.com/p/google-gdata/source/checkout,针对 .NET 4 重新编译,卸载了 YouTube 和 GData API 包,并且在从 F# Interactive 加载带有自定义构建的调试程序集的代码时仍然得到创建时对象引用错误PlayListMember 对象。

更新 3

使用源代码调试 PlayListMember 后,我无法找出问题所在。 PlayListMember 扩展Video 扩展EntryEntry 是唯一一个带有构造函数且为空的条目。那么这个异常是从哪里来的......

I am using the .NET SDK from http://code.google.com/p/google-gdata/downloads/detail?name=YouTube_SDK_1.8.0.0.msi

In F# interactive version 4.0.40219.1 I am simply trying to create a new object of PlayListMember but get a object reference error:

#r @"C:\Program Files (x86)\Google\Google YouTube SDK for .NET\Redist\Google.GData.Client.dll";;
#r @"C:\Program Files (x86)\Google\Google YouTube SDK for .NET\Redist\Google.GData.Extensions.dll";;
#r @"C:\Program Files (x86)\Google\Google YouTube SDK for .NET\Redist\Google.GData.YouTube.dll";;

open Google.GData.Client;;
open Google.GData.Extensions;;
open Google.GData.YouTube;;
open Google.YouTube;;

let pmm = new PlayListMember();;

error FS0193: internal error: Object reference not set to an instance of an object.

If I do the equivelant in C# or F# console app there is no problem. So it appears to be some issue with using this from the F# interactive.

Also I can create a PlayList in F# and use the api to create the list successfully on YouTube. But simply creating a new PlayListMember object fails.

How can I debug this problem?

Update 1

Downloaded the GData SDK which also includes the YouTube SDK from here http://code.google.com/p/google-gdata/downloads/detail?name=Google_Data_API_Setup_1.8.0.0.msi&can=2&q=

Tried the above approach with the new assemblies:

#r @"C:\Program Files (x86)\Google\Google Data API SDK\Redist\Google.GData.Client.dll";;
#r @"C:\Program Files (x86)\Google\Google Data API SDK\Redist\Google.GData.Extensions.dll";;
#r @"C:\Program Files (x86)\Google\Google Data API SDK\Redist\Google.GData.YouTube.dll";;

open Google.GData.Client;;
open Google.GData.Extensions;;
open Google.GData.YouTube;;
open Google.YouTube;;

let pm = new PlayListMember();;

error FS0193: API restriction: The assembly 'file:///C:\Program Files (x86)\Google\Google YouTube SDK for .NET\Redist\Google.GData.YouTube.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.

This error is after a full reboot and opening VS2010 with only the F# interactive. I'm not sure how the assembly in Google YouTube SDK for .NET has been loaded when the references were to Google Data API SDK.

Update 2

Got the latest code from http://code.google.com/p/google-gdata/source/checkout, recompiled for .NET 4, uninstalled both YouTube and GData API packages, and still when loading the code with custom built debug assemblies from F# interactive am getting the Object reference error when creating the PlayListMember object.

Update 3

Having debugged the PlayListMember with the source I can't figure out what is wrong. PlayListMember extends Video extends Entry. Entry is the only one with a constructor and that is empty. Where is this exception coming from then...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海少女心 2024-11-25 18:36:35

作为内部错误,这几乎肯定表明存在编译器错误。我建议发送电子邮件[电子邮件受保护]

As an internal error, this almost certainly indicates a compiler bug. I'd recommend emailing [email protected].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文