HTMLAgilityPack QuerySelectorAll throwing exception, potentially Fizzler dll version mismatch?

c# fizzler html-agility-pack

Question

We recently updated a bunch of dlls in our project, including HtmlAgilityPack to their latest versions. This has made the following code which had been working start throwing errors on the first line.

List<HtmlNode> foundNodes = document.QuerySelectorAll(".divider").ToList();

foreach(HtmlNode node in foundNodes){
    doWhatever(node);
}

Method not found: 'System.Collections.Generic.IEnumerable`1 HtmlAgilityPack.HtmlNode.Descendants()'.

The last line of the stack trace is:

"at Fizzler.Systems.HtmlAgilityPack.HtmlNodeOps.b__71(HtmlNode n)"

The QuerySelectorAll is returning an IEnumerable of HtmlNode, however I can't seem to be able to cast it to a list anymore. I would hazard a guess there is some related dll with an incompatible version now (fizzler?) missing the Descendants method? However the NuGet page for HtmlAgilityPack shows no dependencies, and the fizzler version I'm using is 1.0.0 which I think is correct.

Expert Answer

Disclaimer: I'm the owner of the project Html Agility Pack

The version 1.5.0 has been released, and this issue has been fixed in the v1.5.0-beta5.

It was caused because a default parameter was added to a method in the v1.4.9.5

Since the library is strongly named, Fizzler could not find anymore this method.


Popular Answer

It's happening the same error with me after I upgraded the HtmlAgilityPack nuget package.

I resolved downgrading from 1.4.9.4 to 1.4.9 for now.

Let's see the next versions of this package.




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why