Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/Platform.Xml.Serialization/StringableTypeSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,25 @@ public override string Serialize(object obj, SerializationContext state)
/// </summary>
public override object Deserialize(string value, SerializationContext state)
{
if (formatSpecified)
{
return Convert.ChangeType(value, supportedType, formatAttribute.CultureInfo);
}

try
{
if (formatSpecified)
{
return Convert.ChangeType(value, supportedType, formatAttribute.CultureInfo);
}

return Convert.ChangeType(value, supportedType);
return Convert.ChangeType(value, supportedType);
}
catch(Exception ex)
{
var memberInfo = state.GetCurrentMemberInfo().MemberInfo;
throw new Exception(string.Format("Can't deserialize property {0} of class {1}. Could not convert value '{2}' to type {3}",
memberInfo.Name,
memberInfo.DeclaringType.FullName,
value,
supportedType), ex);
}
}
}
}