Microsoft.Xml.Schema.Linq.XTypedList[[facebook.Schema.user]] serialization problem

Sep 11, 2008 at 7:25 AM
Hello,

Just wondering if anyone has come across such a problem?

Type 'Microsoft.Xml.Schema.Linq.XTypedList`1[[facebook.Schema.user, facebook, Version=2.0.3142.23334, Culture=neutral, PublicKeyToken=null]]' in Assembly 'Microsoft.Xml.Schema.Linq, Version=0.10.1000.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.


I seem to come across this problem when I am initiating my FriendsList webcontrol.

friendList1.Friends = API.friends.getUserObjects

This is the full stack trace. Thanks.
[SerializationException: Type 'Microsoft.Xml.Schema.Linq.XTypedList`1[[facebook.Schema.user, facebook, Version=2.0.3142.23334, Culture=neutral, PublicKeyToken=null]]' in Assembly 'Microsoft.Xml.Schema.Linq, Version=0.10.1000.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.]

System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +2700482

System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +245

System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +88

System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +175

System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +50

System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +438

System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +131

System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) +13

System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3010



[ArgumentException: Error serializing value 'Microsoft.Xml.Schema.Linq.XTypedList`1[facebook.Schema.user]' of type 'Microsoft.Xml.Schema.Linq.XTypedList`1[[facebook.Schema.user, facebook, Version=2.0.3142.23334, Culture=neutral, PublicKeyToken=null]].']

System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3217

System.Web.UI.ObjectStateFormatter.Serialize(Stream outputStream, Object stateGraph) +126

System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +52

System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize(Object state) +4

System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter, Object stateGraph) +37

System.Web.UI.HiddenFieldPageStatePersister.Save() +106

System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) +82

System.Web.UI.Page.SaveAllState() +550

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2357

Sep 11, 2008 at 1:27 PM
Not had that problem, but quick suggestion:

Do you have the Microsoft.Xml.Schema.Linq dll referenced properly? it's included with the toolkit in the bin zip folder provided for the toolkit.
Sep 11, 2008 at 10:49 PM
Thanks for your reply.

Yes. I am very sure that I have referenced the necessary references in the toolkit including Microsoft.Xml.Schema.Linq.dll .


Sep 24, 2008 at 4:20 PM
Hi,

I'm having the same issue. I have 2 labels to display name and location. I thought at the beginning I can initiate the facebook.Schema.user using API.users.getInfo() as I saw in the IFrameCanvasSample project. Assigning the location to my lable like this litLocation.Text = UserProfile.User.current_location.city.ToString(); This causing the problem, I don't know why.
If I remove the lable controls and also the form control and just put the UserProfile control, it works, but this doesn't make any sense at all since asp .net need the form tag with runat=server. So what is the purpose of this iframecanvas if we cannot use the native asp .net controls?
The IframeCanvasSample project did the same thing, no form tag, no asp.net controls, well at the end a very primitive working sample showing only my profile and friends list, anything more advanced?
Sep 24, 2008 at 11:54 PM
Argh.  Having the same issue
Sep 25, 2008 at 2:28 PM
after hours of trying and scratching my head because of the documentation that sometimes difficult to understand e.g. Facebook class is facebook or I still cannot find Facebook.Entity.User,
I found my self what I want to by doing this:

    public partial class Default : CanvasIFrameBasePage
    {
        new protected void Page_Load(object sender, EventArgs e)
        {
            base.Api = ConfigurationManager.AppSettings["APIKey"].ToString();
            base.Secret = ConfigurationManager.AppSettings["Secret"].ToString();
            base.Page_Load(sender, e);
            if (!IsPostBack)
            {
                litName.Text = API.users.getInfo(Master.API.uid).name;//
            }
        }
    }

on my aspx page, i cannot use any of the controls come from facebook.web such as FriendList, UserProfile, PhotoAlbum, and I don't why I cannot use them together with my asp .net controls, Am I missing something from the documentation?


Oct 10, 2008 at 8:52 AM
I'm having the same problem as well when using the FriendsList and UserProfile - I'm getting the following error:
Type 'facebook.Schema.user' in Assembly 'facebook, Version=2.0.3159.28499, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
...and I have the Microsoft.Xml.Schema.Linq dll referenced properly?

Does anyone know how to resolve this? 
Oct 10, 2008 at 9:01 AM
Quick update - I just taken out the form tags and the error has disappeared..
Nov 5, 2008 at 6:59 AM
Fwiw, rather than removing the form tag which prevents you from using ASP.NET controls you can set UseViewState="false" on the Facebook toolkit controls.
Developer
Nov 5, 2008 at 2:11 PM
As mentioned in a few other places now, this issue is now fixed: http://www.codeplex.com/FacebookToolkit/WorkItem/View.aspx?WorkItemId=11081