This project has moved and is read-only. For the latest updates, please go here.

Getting No Source available Error - There no source code available for the current location when using HtmlAgilityPack

Topics: Developer Forum, User Forum
Sep 2, 2014 at 8:47 PM
I am the beginner and trying to read an HTML page ( .htm page) , which is on my local drive using HtmlAgilityPack in C#.

Here are the things which i did.
  1. Using Visual Studio 2012, first i installed HtmlAgilityPack using Package Manager Console -- NuGet.
  2. It added HtmlAgilityPack dll to my project.
  3. Here is my code. I started running my code in debug mode, when it reached the below line
    HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
  4. I got an error saying that
    No Source available
    There no source code available for the current location.
I am confused now. What source code it is looking for and Why it is looking for the source code as we already have the dll attached to the project

So, here are my questions on this issue
  1. What is this error means. If it is looking for the source code, how can i get it.
  2. How can i get the same source code for the HtmlAgilityPack which it was installed
  3. how can I make it available to my application
  4. how can i read the html tables
             DirectoryInfo theFolder = new DirectoryInfo("\\\\MYPC\\Users\\Desktop");
             System.IO.FileInfo[] file = theFolder.GetFiles();
             int len = file.Length;
             if (file.Length > 1)
                 int intLength;
                 fileName = Convert.ToString(file.GetValue(0));
                 intLength = fileName.IndexOf("_");
             string FileName = "\\\\MYPC\\Users\\Desktop" + fileName;
             // Load the html document
             HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
             // Get all tables in the document
             HtmlNodeCollection tables = doc.DocumentNode.SelectNodes("//TABLE");                 
             HtmlNodeCollection rows = tables(0).SelectNodes(".//TR");
             for (int i = 0; i < rows.Count; ++i)
                  HtmlNodeCollection cols = rows(i).SelectNodes(".//TD");
                 for (int j = 0; j < cols.Count; ++j)
                     // Get the value of the column and print it
                     string value = cols(j).InnerText;
         catch (Exception objError)
             throw objError;

Sep 2, 2014 at 10:58 PM
I'd say it could be this line of code
string FileName = "\\MYPC\Users\Desktop" + fileName;

you are missing a back slash between Desktop and filename. so it's trying to load file Desktopabc.htm
Sep 3, 2014 at 8:14 AM
Hi LeeJeary, Thanks for your response. Anyway here is what exactly happening.

When my debug pointer going to HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); line in the code

it is throwing the below error

Source file:
Module: c:\users........\Debug\HtmlAgilityPacl.dll

The source file is different from when the module was built. Would you like to use it anyway?

and giving options YES & NO

If i select YES - its give me the above alert for couple of other files in source code and finally fails and throws this alert.

Source file information;

Locating source for 'd:\Source\\Trunk\HtmlAgilityPack\HtmlDocument.PathMethods.cs'. Checksum: MD5 {21 f3 9f 31 c1 6a 76 67 a7 c1 d8 6f 9b b2 66 7d}
The file 'd:\Source\\Trunk\HtmlAgilityPack\HtmlDocument.PathMethods.cs' does not exist.
Looking in script documents for 'd:\Source\\Trunk\HtmlAgilityPack\HtmlDocument.PathMethods.cs'...
Looking in the projects for 'd:\Source\\Trunk\HtmlAgilityPack\HtmlDocument.PathMethods.cs'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\vccorlib\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include'...
Looking in directory 'C:\Users\sunil\Desktop\HtmlAgilityPack\Release\1_4_0\'...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: d:\Source\\Trunk\HtmlAgilityPack\HtmlDocument.PathMethods.cs.
The debugger could not locate the source file 'd:\Source\\Trunk\HtmlAgilityPack\HtmlDocument.PathMethods.cs'.

If i selects NO - it asks me to select the source code again.

I installed version

Do you any thoughts.
Sep 3, 2014 at 9:05 AM
I think this is just a red herring.. did you try changing the path like I mentioned?

Sep 3, 2014 at 9:17 AM
Hi Lee, Here is the FileName full path. I am not sure this is an issue, as the file path in filename variable is showing as below.


Here is a question.

Why it is giving me an alert for the source code?

how can get the similar version of HtmlAgilityPack source code?

Do i need to copy this source code to my project?

Let me know.
Sep 3, 2014 at 10:18 AM
Normally the reason for this is that you have the HtmlAgilityPack.pdb and HtmlAgilityPack.dll files included in the project and thinks that you are able to debug the dll using source code from your machine.

But the error is still going to be something with the file path as the error is being raised in the file PathMethods.cs

Let me know if thats not the case and you don't have the pdb file included and its not in your debug output folder.

you do not need to copy the source to your project you should be able to just use the dll on its own.


Sep 3, 2014 at 6:17 PM
Hi Lee, thanks. got it. yes, its the file path issue. there is some permissions issue on that folder, we fixed it and it got resolved now. thanks for u r help. Sunil P