HtmlAgilityPack.HtmlDocument () error

In my application, I want to use HTMLAgilityPack

which was installed with NuGet. But when I try to instantiate HtmlAgilityPack.HtmlDocument

I have

Source not found error with HtmlDocument.cs.

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

      

Solution Explorer-> Links contain HTMLAgilityPack

. What's wrong?

+3


source to share


2 answers


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

When you cancel the Find Source dialog for the first time, Visual Studio will add the source file path to the exclusion list and will no longer prompt you (this list is in: Solution Explorer -> Right click on the solution -> Properties-> General Properties- > Debug source files -> Don't search for these source files).



To prevent the "HtmlDocument.cs not found" page from appearing during debugging, you need to step over (F10) the calls to HtmlAgilityPack, not step into them (F11).

+1


source


I could reproduce your error by debugging the code for the Windows Store app:

picker.FileTypeFilter.Add(".htm");
StorageFile file = await picker.PickSingleFileAsync();
var accessStream = await file.OpenAsync(FileAccessMode.Read);

var doc = new HtmlDocument();
doc.Load(accessStream.AsStreamForRead());

      



If I set a breakpoint in a variable definition for HtmlDocument, an error occurs because HtmlDocument.cs will look in a different section. If I set a breakpoint after the last line, no error occurs.

Perhaps something to do with asynchronous programming ...

0


source







All Articles