Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3220420
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:45:34+00:00 2026-05-17T15:45:34+00:00

I am using the Facebook-c-sharp to upload photos to Facebook. This code works fine

  • 0

I am using the Facebook-c-sharp to upload photos to Facebook. This code works fine but for new accounts of Facebook this code seems to have problem. I thought may be its something to do with the new privacy policies of Facebook and moreover authors of above code have stopped working on new releases.
The problem seems to be with creating albums. With old account of FB, the album gets created and photos are uploaded properly. For new account(created recently, about 20 days back), the photo album gets created but when the Facebook returns the XML response, I get an XMLException thrown when I try to deserialize the XML.

The XML response for old account is below

    <?xml version="1.0" encoding="UTF-8"?>
<photos_createAlbum_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
  <aid>2470234845268380151</aid>
  <owner>number</owner>
  <name>AlbumName</name>
  <created>number</created>
  <modified>number</modified>
  <description>description</description>
  <location>location</location>
  <link>url of the album created</link>
  <size>0</size>
  <visible>privacy setting</visible>
  <modified_major>number</modified_major>
  <object_id>number</object_id>
</photos_createAlbum_response>

The xml response for new account is below

    <?xml version="1.0" encoding="UTF-8"?>
<photos_createAlbum_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
  <aid>100001291780378_24994</aid>
  <owner>number</owner>
  <name>AlbumName</name>
  <created>number</created>
  <modified>number</modified>
  <description>description</description>
  <location>location</location>
  <link>url of the album created</link>
  <size>0</size>
  <visible>privacy setting</visible>
  <modified_major>number</modified_major>
  <object_id>number</object_id>
</photos_createAlbum_response>

The XMLException I am getting is below (again:this is happening only for new accounts. old account deserialize works just fine)

type=Mono.Facebook.XMLException

message=Failed parsing XML

stack=
   at Mono.Facebook.Util.GetResponse[T](String method_name, FacebookParam[] parameters)
   at Mono.Facebook.FacebookSession.CreateAlbum(String name, String description, String location)
   at Facebook.PostToFacebook(List`1 photos, String apiKey, String apiSecret, String authToken)



type=System.InvalidOperationException

message=There is an error in XML document (0, 0).

stack=
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
   at Mono.Facebook.Util.GetResponse[T](String method_name, FacebookParam[] parameters)

As you can see both the XML responses from Facebook for old and new account are similar. But still for new account deserialize fails. Why is this happening? The only difference I could find in both the xml files was the presence of “underscore _” in (albumid) in second XML file. But as far as I know underscore is valid xml and should not be a problem parsing right? Can someone tell why am I getting this error.

EDIT:

I got it working. As mentioned above, underscore was causing the problem. It was quite silly on my part that I did not check that. In C# code aid was declared as long. Since string with underscore cannot be deserialized to long I was getting exception. I copied the xml response from Facebook into a xml file then did xsd Facebook.xml and xsd Facebook.xsd to get Facebook.cs. I compared generated cs file with the one I have and saw that aid was declared as String in generated cs and long in my file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:45:34+00:00Added an answer on May 17, 2026 at 3:45 pm

    I got it working. As mentioned above, underscore was causing the problem. It was quite silly on my part that I did not check that. In C# code aid was declared as long. Since string with underscore cannot be deserialized to long I was getting exception. I copied the xml response from Facebook into a xml file then did xsd Facebook.xml and xsd Facebook.xsd to get Facebook.cs. I compared generated cs file with the one I have and saw that aid was declared as String in generated cs and long in my file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using facebook open graph, new api, and i can do this: <fb:login-button show-faces=true
I have the demo facebook app and without any modification this is the code:
I am trying to implement share this method. I am using the code as
I tried using facebook API but once i tried integrating it. I noticed that
This is probably a n00b question, but nontheless... I have a bit of a
Using the Facebook API, is there a way of getting a friend's phone/cell number?
Using online interfaces to a version control system is a nice way to have
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
for my app I am using Facebook connect to share something from my app
I am using Facebook Connect for sharing something on my appliction. So I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.