XML serializtion in Integration Studio exctension c#

I please nee dsome advice on serializing an OutSystems generated RecrodList in integration studio. 

My scenario:

I have a small structure of 3 fields that I created in Integration Studio. This I used in my Extension implementation to build up a recordlist of data. This recordlist I want to serialize to XML to add as a field to a database table record as a field; that is the field is type string and its contents will be an XML string. 

Why would you ask I do not do this in Service Studio? Losts of reasons, I read a very specifically formatted text filed for which there is no way to read in Service Studio, I need C# code for this, and also the file has millions of records, so I read the file and do a bulk insert all in one go to make this optimal. But this is just background and nothing to do with the issue, just so you udnerstand.

The issue is I need for each record inserted this one field to contain the XML and I cannot for the life of me find a way to serialize to XML. I tried all the System.XML.Serialization methods, but it does not work. I keep getting the following error on the structure (the one that starts with "ST" according to OutSystems convention) :

There was an error reflecting type 'OutSystems.NssDI_TextToDataMapping.STTestBulkRecordStructure'

The stack trace:

To be XML serializable, types which inherit from ICollection must have an implementation of Add(System.Boolean) at all levels of their inheritance hierarchy. System.Collections.BitArray does not implement Add(System.Boolean).
   at System.Xml.Serialization.TypeScope.GetDefaultIndexer(Type type, String memberInfo)
   at System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, MemberInfo memberInfo, Boolean directReference)
   at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError)
   at System.Xml.Serialization.StructModel.GetFieldModel(FieldInfo fieldInfo)
   at System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo)
   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)

I noticed there is a "ToXML" implementation on the structure, but how do I use that, that function has absolutely NO comments in the generated OutSystems code.

Please can OutSystems technical guys help me out here. It is quite urgent.

Thank you in advance.

Hi Elize,

Did you check the code from the XML Records component? It can show you how to traverse OutSystems record lists and structures.

Hi Kilian,

Thank you for the suggestion, yes that is an idea, I did try to open the XML implementation that comes with OutSystems server to see how they did it, but I could not find how to open the code.

However I also cannot open the XML Record component, it is an oap, it does not install on our environment, when I publish I get these errors:

You are not allowed to publish this extension. You don't have enough permissions over the database connections that own the following external entities: TestEntRecord.

Failed to publish 'XML_Records' solution because it is empty, or all modules have conflicts.

You ever seen anything like this?

Going to ask one of the other guys to try and install. Or try my personal environment.

O goodie, it worked on my personal environment, so at least I can see this code for an example.