Odd serialization exception - Silverlight

Odd serialization exception - Silverlight

Old forum URL: forums.lhotka.net/forums/t/7060.aspx


skagen00 posted on Monday, June 08, 2009

I'm using SL 3.0 with CSLA 3.6.2

Type '' with data contract name ':http://schemas.datacontract.org/2004/07/' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.

This is occurring when the mobile formatter is trying to serialize a criteria class...

[Serializable()]
public class IndividualInfoListCriteria : CriteriaBase
{
#pragma warning disable 0618 // Disable warning
public IndividualInfoListCriteria() : base(typeof(IndividualInfoListCriteria)) { }
#pragma warning restore 0618

private string _firstName;
private string _lastName;

public string FirstName
{
get
{
return _firstName;
}
}

public string LastName
{
get
{
return _lastName;
}
}

public IndividualInfoListCriteria(string firstName, string lastName)
{
_firstName = firstName;
_lastName = lastName;
}

protected override void OnGetState(Csla.Serialization.Mobile.SerializationInfo info, StateMode mode)
{
info.AddValue("_firstName", _firstName);
info.AddValue("_lastName", _lastName);
base.OnGetState(info, mode);
}

protected override void OnSetState(Csla.Serialization.Mobile.SerializationInfo info, StateMode mode)
{
_firstName = (string)info.Values["_firstName"].Value;
_lastName = (string)info.Values["_lastName"].Value;
base.OnSetState(info, mode);
}
}

I'm kind of at a loss right now.... anyone seen this one or have any suggestions?

skagen00 replied on Monday, June 08, 2009

Please disregard the question - I was misusing a class.

Copyright (c) Marimer LLC