HtmlAgilityPack.HtmlDocument() cause error

c# dll html-agility-pack reference

Question

In my app I want to use HTMLAgilityPack which had been installed using NuGet. But when I try to create HtmlAgilityPack.HtmlDocument instance, I've got

"Source not found" error with HtmlDocument.cs.

HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();

Solution Explorer->References does contain HtmlAgilityPack. What's wrong?

Popular Answer

This happens when your code throws an exception and the debugger tries to show you the code, or when you step into the call.

When you cancel the "Find Source" dialog for the first time, Visual Studio will add the source file path to an exception list and will not ask you again (This list is at: Solution Explorer->Right click on solution->Properties->Common Properties->Debug Source Files->Do not look for these source files).

In order to prevent the "HtmlDocument.cs not found" page from appearing when debugging, you need to step over (F10) the HtmlAgilityPack's calls instead of stepping into them (F11).




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