我使用的.NET SDK從http://code.google.com/p/google-gdata/downloads/detail?name=YouTube_SDK_1.8.0.0.msi錯誤從YouTube API構建PlayListMember對象 - C#ok了F#錯誤
在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#控制檯應用程序中做equivelant沒有問題。所以從F#交互中使用它似乎存在一些問題。
另外,我可以在F#中創建一個PlayList,並使用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 YouTube SDK for .NET中的程序集是如何在Google Data API SDK中加載的。
更新2
加載與F#互動正在逐漸的定製調試組件的代碼時,得到了http://code.google.com/p/google-gdata/source/checkout最新的代碼,重新編譯爲.NET 4,卸載YouTube和其他的GData API包,而且還創建PlayListMember對象時的對象引用錯誤。
更新3
已經調試的PlayListMember
與我無法弄清楚什麼是錯的來源。 PlayListMember
延伸Video
延伸Entry
。 Entry
是唯一一個帶有構造函數並且是空的。這個異常來自哪裏...
只是猜測,而不是完全限定Google dll的路徑,只是引用程序集的名稱(例如'#r「Google.GData.Client」'),因爲我敢打賭他們正在安裝在GAC中GData SDK下載是MSI)。 –
有趣的是,這樣做和'綁定會話'C:\ Program Files文件(x86)\谷歌\谷歌YouTube SDK for .NET \ Redist \ Google.GData.YouTube.dll'...'然後得到原來的錯誤' FS0193:內部錯誤:對象引用未設置爲對象的實例。將嘗試卸載GAC程序集。 – yanta