Stackoverflowbug in Node.Attributes.RemoveAll()

Topics: Developer Forum
Jun 2, 2010 at 12:52 PM

Hi There, 

So, I had a stackoverflow bug in my htmlagilitypack from january.

The bug is this: If I call attributes.removeall on a node with no attributes, it rarely but sometimes result in a stackoverflow bug when exporting the text to a string (either using doc.save() or otherwise)..

 

So the removal of the attributes works fine. Its when exporting the stackoverflow occurs.

Currently I fixed it with an extension:

        public static void ClearAttributes(this HtmlAgilityPack.HtmlNode node)        {            if (node.Attributes.Count > 0)                node.Attributes.RemoveAll();        }

that I call instead. That seems to have fixed the problem.

Sincerely yours

- Sky

Btw. thank you for a fantastic product. :)