Failed to Serilize Error ComponentSpace.SAML2.Assertions.AttributeValue.ToXml(XmlDocument xmlDocument, IAttributeValueSerializer attributeValueSerializer)

Iam getting below error when trying to serilize SAMLAssertionToXml().OuterXml.ToString()
Failed to Serilize Error ComponentSpace.SAML2.Assertions.AttributeValue.ToXml(XmlDocument xmlDocument, IAttributeValueSerializer attributeValueSerializer)


My Saml Attributes are something lke below
foreach (SAMLModuleAttribute attb in lstAttributes)
{
attStatement.Attributes.Add(new SAMLAttribute(attb.AttributeName, SAMLIdentifiers.AttributeNameFormats.Basic,
attb.FriendlyName, attb.AttributeValue));
SAMLAttribute attrib = new SAMLAttribute();
attrib.Name = attb.AttributeName;
attrib.FriendlyName = attb.FriendlyName;
attrib.NameFormat = SAMLIdentifiers.AttributeNameFormats.Basic;

if (attb.AttributeValues != null && attb.AttributeValues.Count > 0)
{
foreach (var attrinuteValue in attb.AttributeValues)
{
var attributeValue = new AttributeValue(attrinuteValue);
attrib.Values.Add(new AttributeValue(attrinuteValue));
}
}
else
attrib.Values.Add(new AttributeValue(attb.AttributeValue));

attStatement.Attributes.Add(attrib);
}

Please enable SAML trace and send the generated log file as an email attachment to support@componentspace.com mentioning your forum post.
https://www.componentspace.com/Forums/17/Enabing-SAML-Trace