LLBLGen Pro v2.6 WriteXML

Posts   
 
    
fmark
User
Posts: 3
Joined: 08-Jan-2019
# Posted on: 08-Jan-2019 13:09:53   

We are using LLBLGen Pro v2.6 in a project and the Entity.WriteXML function throw a System.OutOfMemoryExcetion when the xml string is too big.

Could you please suggest a solution for this problem?

Thank you in advance.

Mark

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 09-Jan-2019 05:18:44   

Do you have a stack trace?

P.S. LLBLGen Pro 2.6 is out of support, please try to upgrade to the latest release.

fmark
User
Posts: 3
Joined: 08-Jan-2019
# Posted on: 09-Jan-2019 10:21:53   

Hello Walaa,

I know that this is a very old version, but we have no licence for the new version.

Here are the Stack trace: at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity) at System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength) at System.Text.StringBuilder.Append(String value) at System.IO.StringWriter.Write(String value) at System.Xml.XmlTextWriter.InternalWriteEndElement(Boolean longFormat) at System.Xml.XmlTextWriter.WriteFullEndElement() at System.Xml.XmlElement.WriteElementTo(XmlWriter writer, XmlElement e) at System.Xml.XmlElement.WriteTo(XmlWriter w) at System.Xml.XmlNode.get_OuterXml() at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase.WriteXml(XmlFormatAspect aspects, String rootNodeName, String& entityXml) at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase.WriteXml(XmlFormatAspect aspects, String& entityXml)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 09-Jan-2019 10:48:38   

I do recall this is a bug in .net, not sure which version you're using, but it is recommended you use at least .net 4.5.2 or higher. (As I think you don't have an xml string > 64GB in size wink )

Frans Bouma | Lead developer LLBLGen Pro
fmark
User
Posts: 3
Joined: 08-Jan-2019
# Posted on: 09-Jan-2019 11:18:08   

Otis wrote:

I do recall this is a bug in .net, not sure which version you're using, but it is recommended you use at least .net 4.5.2 or higher. (As I think you don't have an xml string > 64GB in size wink )

As I read somewhere, the maximum size of a string is 2GB, but this is 1 billion character in unicode format. Our software has around 700 MB memory consumption when the exception throwed.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 09-Jan-2019 13:22:46   

So your xml string is 1 billion (with a B) characters long? Unicode chars are 2bytes per char, so that'll give you 2GB I think.

An xml string of 1 Billion characters takes ages to parse, why do you use such a big document? In any case, you're running into limitations of .NET (at least the version you're using) I think, as the issue occurs inside the string builder.

Writing the xml, it will append the fragments to a string builder internally which will then be used to construct the string. Your set of entities is simply very very very large, so serializing them together to 1 document is running into this limitation.

I'd serialize less entities to xml, as it must be a massive amount of data you're serializing...

Frans Bouma | Lead developer LLBLGen Pro