Posted 7 April 2020, 8:56 am EST
I am converting from a previous version, and have not had an issue with serialization. Once I converted to AR14, it keeps failing on the serialization. Any help is appreciated. Here is a code snippet -
public class SomeReport : SectionReport
{
//...
}
public void Test()
{
try
{
SomeReport report = new SomeReport();
report.DataSource = new List<string>();
report.Run();
var ser = Serialize<SectionDocument>(report.Document);
}
catch (Exception ex)
{
var temp = ex;
}
}
public static byte[] Serialize<T>(T data)
{
DataContractSerializer serializer = new DataContractSerializer(typeof(T));
using (MemoryStream memoryStreamSource = new MemoryStream())
{
serializer.WriteObject(memoryStreamSource, data);
using (MemoryStream memoryStreamDestination = new MemoryStream())
{
return memoryStreamDestination.ToArray();
}
}
}