Error with Starter Kit

Dec 31, 2009 at 6:37 PM

 

Using the 3.0 toolkit and this starter kit:

http://www.stevetrefethen.com/wiki/Facebook application development in ASP.NET.ashx

after changing everything to match 3.0,  I got this error:

 

Exception Details: System.Xml.XmlException: 'xsi:nil' is a duplicate attribute name. Line 3, position 66.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[XmlException: 'xsi:nil' is a duplicate attribute name. Line 3, position 66.]
System.Xml.XmlTextReaderImpl.Throw(Exception e) +76
System.Xml.XmlTextReaderImpl.AttributeDuplCheck() +393
System.Xml.XmlTextReaderImpl.ParseAttributes() +3979439
System.Xml.XmlTextReaderImpl.ParseElement() +343
System.Xml.XmlTextReaderImpl.ParseElementContent() +121
System.Xml.XmlTextReaderImpl.Read() +45
System.Xml.XmlTextReader.Read() +15
System.Xml.XmlReader.ReadStartElement() +38
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderuser.Read19_user(Boolean isNullable, Boolean checkType) +326
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderuser.Read20_user() +79

[InvalidOperationException: There is an error in XML document (3, 66).]
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +613
System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream) +102
Facebook.Utility.Utilities.DeserializeXML(String xmlInput) +291

[FacebookException: Could not deserialize data returned from server]
Facebook.Utility.Utilities.DeserializeXML(String xmlInput) +349
Facebook.Web.FriendList.<LoadFromViewState>b__2(String friendXML) +9
System.Linq.WhereSelectListIterator`2.MoveNext() +107
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +7667508
System.Linq.Enumerable.ToList(IEnumerable`1 source) +61
Facebook.Web.FriendList.LoadFromViewState() +149
Facebook.Web.FriendList.OnLoad(EventArgs e) +20
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Jun 21, 2010 at 9:26 PM

I have the same problem.

On my aspx page I have

<%@ Register Assembly="Facebook.Web" Namespace="Facebook.Web" TagPrefix="cc2" %>

...

<cc2:FriendList ID="FriendList1" runat="server" />

...

And on my aspx.cs page I have

System.Collections.Generic.IList<Facebook.Schema.user> f = api.Friends.GetUserObjects();
FriendList1.Friends = f;

Works fine with accounts with no friends, I see the following output:

Friends List

You have no friends

I don't know what I did wrong or how to prevent duplicates in friends list.

Please help.

 

Here is my stack trace:

[XmlException: 'xsi:nil' is a duplicate attribute name. Line 3, position 71.]
   System.Xml.XmlTextReaderImpl.Throw(Exception e) +95
   System.Xml.XmlTextReaderImpl.AttributeDuplCheck() +701
   System.Xml.XmlTextReaderImpl.ParseAttributes() +5090000
   System.Xml.XmlTextReaderImpl.ParseElement() +378
   System.Xml.XmlTextReaderImpl.ParseElementContent() +199
   System.Xml.XmlReader.ReadStartElement() +44
   Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderuser.Read19_user(Boolean isNullable, Boolean checkType) +914
   Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderuser.Read20_user() +285

[InvalidOperationException: There is an error in XML document (3, 71).]
   System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +1479
   System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream) +252
   Facebook.Utility.Utilities.DeserializeXML(String xmlInput) +583

[FacebookException: Could not deserialize data returned from server]
   Facebook.Utility.Utilities.DeserializeXML(String xmlInput) +777
   Facebook.Web.FriendList.b__2(String friendXML) +59
   System.Linq.WhereSelectListIterator`2.MoveNext() +318
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +578
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +78
   Facebook.Web.FriendList.LoadFromViewState() +356
   Facebook.Web.FriendList.OnLoad(EventArgs e) +63
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428

Jun 21, 2010 at 10:10 PM

i am not using that article, but still have that problem.

Jun 21, 2010 at 11:06 PM

I looked through the source code of FriendList component and found out that line 177 had an error:

output.Write(friend.hometown_location.city + ", " + friend.hometown_location.state);

hometown_location object may be null for some of your facebook friends.

And because of the same error de-serialization doesn't work properly (line 112).