StackOverflowException in HtmlNodeCollection.GetEnumerator()

Topics: Developer Forum, User Forum
Dec 4, 2015 at 8:58 AM
Edited Dec 4, 2015 at 8:59 AM
Hi!

I'm writing a web crawler, and I get a StackOverflowException in HtmlNodeCollection.GetEnumerator(), but on the call stack there are a lot of HtmlNode.CloseNode() calls:

HtmlAgilityPack.dll!HtmlAgilityPack.HtmlNode.CloseNode(HtmlAgilityPack.HtmlNode endnode) Line 1679 C#
HtmlAgilityPack.dll!HtmlAgilityPack.HtmlNode.CloseNode(HtmlAgilityPack.HtmlNode endnode) Line 1679 C#
HtmlAgilityPack.dll!HtmlAgilityPack.HtmlNode.CloseNode(HtmlAgilityPack.HtmlNode endnode) Line 1679 C#
...

Line 1679 is: foreach (HtmlNode child in _childnodes)


I don't know what page it is on. However, even if I knew what pages it was on, what can I do about it? OptionFixNestedTags doesn't help, and since StackOverflowException can't be caught, I'm not sure what I can do about it.


Any ideas?