I call a method in a library which needs to receive XML. One of the fields in this XML is called "usercomments" where the user can enter free form text from the front-end. Some of our users have figured out a way of crashing the system.
When certain hexadecimal characters make their way to the database, the method in the library fails.

This is the kind of error that I receive when the field to the XML Parser.
PHP Code:
System.ArgumentException occurred
  Message
=''hexadecimal value 0x13is an invalid character.
  
Source=System.Xml
  StackTrace
:
       
at System.Xml.XmlEncodedRawTextWriter.InvalidXmlChar(Int32 chCharpDstBoolean entitize)
       
at System.Xml.XmlEncodedRawTextWriter.WriteElementTextBlock(CharpSrcCharpSrcEnd)
       
at System.Xml.XmlEncodedRawTextWriter.WriteString(String text)
       
at System.Xml.XmlEncodedRawTextWriterIndent.WriteString(String text)
       
at System.Xml.XmlWellFormedWriter.WriteString(String text)
       
at System.Xml.XmlWriter.WriteElementString(String localNameString nsString value)
       
at System.Xml.XmlWriter.WriteElementString(String localNameString value)
       
at Ax.Frameworks.BOF.VOBase.WriteXMLElement(gt dbXmlWriter xmlWriterbz dbFldInfosa0 pType typeBOFDbTblAttribute dbTblBoolean excludeKeyFields)
       
at Ax.Frameworks.BOF.VOBase.ToXML(gt dbXmlWriter xmlWriterBoolean excludeKeyFields)
       
at Ax.Frameworks.BOF.VOBaseCollection.ToXML(gt dbXmlWriter xmlWriterBoolean excludeKeyFields)
       
at Ax.Frameworks.BOF.VOBase.WriteXMLElement(gt dbXmlWriter xmlWriterbz dbFldInfosa0 pType typeBOFDbTblAttribute dbTblBoolean excludeKeyFields)
       
at Ax.Frameworks.BOF.VOBase.ToXML(gt dbXmlWriter xmlWriterBoolean excludeKeyFields)
       
at Ax.Frameworks.BOF.VOBase.ToXML(gt dbXmlWriter xmlWriter)
       
at Ax.Frameworks.BOF.VOBase.ToXML(Boolean includeEncoding)
       
at Ax.Frameworks.BOF.VOBase.ToXML()
       
at AxPartyClass.AxPartyC.SetPartyContainer(String iPartyTypein PartyC.cs:line 233
  InnerException

Is there some kind of method in C# that will sanitize this and remove all the invalid hexadecimal characters from the text fields, so that I can do a cleanup of the comments field.

By invalid hexadecimal characters, I mean those characters which the XML parser won't be able to parse. I don't have a list of which characters break the library and which don't.