2
votes

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...

1
Just a guess, instead of fully qualifying the path to the Google dlls, just reference the name of the assemblies (e.g. #r "Google.GData.Client") since I bet they are being installed in the GAC (the GData SDK download is an MSI).Stephen Swensen
Interesting, did this and Binding session to 'C:\Program Files (x86)\Google\Google YouTube SDK for .NET\Redist\Google.GData.YouTube.dll'... and then get the original error FS0193: internal error: Object reference not set to an instance of an object. Will try uninstall the GAC assemblies.yanta

1 Answers

0
votes

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