I am making a Windows Phone 8.1 Silverlight Application. I want LinkedIn Authentication in it. I got 1-3 samples from internet. but they all are reporting error on same line:
using System.Xml.Serialization;
personXerializer = new XmlSerializer(typeof(SampleLinkedApp.Data.person));
Giving me Error:
An exception of type 'System.InvalidOperationException' occurred in System.Xml.Serialization.ni.dll but was not handled in user code Additional information: There was an error reflecting type 'SampleLinkedApp.Data.person'.
Also, person.cs:
[XmlRoot("person")]
public class person
{
[XmlElement("first-name")]
public string FirstName { get; set; }
[XmlElement("last-name")]
public string LastName { get; set; }
[XmlElement("headline")]
public string Headline { get; set; }
[XmlElement("headline")]
public string Interests { get; set; }
}
Where Is the problem?
Also adding inner exception to this question:
{System.InvalidOperationException: There was an error reflecting property 'Interests'. ---> System.InvalidOperationException: The XML element 'headline' from namespace '' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element.
at System.Xml.Serialization.XmlReflectionImporter.AddUniqueAccessor(INameScope scope, Accessor accessor)
at System.Xml.Serialization.XmlReflectionImporter.AddUniqueAccessor(MemberMapping member, INameScope elements, INameScope attributes, Boolean isSequence)
at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)}
No comments:
Post a Comment