Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7694265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:16:49+00:00 2026-05-31T21:16:49+00:00

I try to run the following code: public void Init(Url rootUrl) { var web

  • 0

I try to run the following code:

 public void Init(Url rootUrl)
        {
             var web = new HtmlWeb();
            this.doc = web.Load(rootUrl.Value);
        }

with the following param:

{<System.Security.Policy.Url version="1">
<Url>http://localhost:85/HCM/HCM.html</Url>
</System.Security.Policy.Url>
}

and get the following exception:
Object reference not set to an instance of an object.

Stack Trace:

   at HtmlAgilityPack.HtmlDocument.ReadDocumentEncoding(HtmlNode node) in C:\Source\htmlagilitypack\Trunk\HtmlAgilityPack\HtmlDocument.cs:line 1916
   at HtmlAgilityPack.HtmlDocument.PushNodeEnd(Int32 index, Boolean close) in C:\Source\htmlagilitypack\Trunk\HtmlAgilityPack\HtmlDocument.cs:line 1805
   at HtmlAgilityPack.HtmlDocument.Parse() in C:\Source\htmlagilitypack\Trunk\HtmlAgilityPack\HtmlDocument.cs:line 1492
   at HtmlAgilityPack.HtmlDocument.Load(TextReader reader) in C:\Source\htmlagilitypack\Trunk\HtmlAgilityPack\HtmlDocument.cs:line 769
   at HtmlAgilityPack.HtmlDocument.Load(Stream stream, Boolean detectEncodingFromByteOrderMarks) in C:\Source\htmlagilitypack\Trunk\HtmlAgilityPack\HtmlDocument.cs:line 597
   at HtmlAgilityPack.HtmlWeb.Get(Uri uri, String method, String path, HtmlDocument doc, IWebProxy proxy, ICredentials creds) in C:\Source\htmlagilitypack\Trunk\HtmlAgilityPack\HtmlWeb.cs:line 1515
   at HtmlAgilityPack.HtmlWeb.LoadUrl(Uri uri, String method, WebProxy proxy, NetworkCredential creds) in C:\Source\htmlagilitypack\Trunk\HtmlAgilityPack\HtmlWeb.cs:line 1563
   at HtmlAgilityPack.HtmlWeb.Load(String url, String method) in C:\Source\htmlagilitypack\Trunk\HtmlAgilityPack\HtmlWeb.cs:line 1152
   at HtmlAgilityPack.HtmlWeb.Load(String url) in C:\Source\htmlagilitypack\Trunk\HtmlAgilityPack\HtmlWeb.cs:line 1107
   at Conduit.CPServices.Logic.HtmlContentMonitor.HtmlAgilityPackHtmlProvider.Init(Url rootUrl) in D:\Conduit\RnD\Server\Services\CP\CPServices\Logic\HtmlContentMonitor\Conduit.CPServices.Logic.HtmlContentMonitor\HtmlAgilityPackHtmlProvider.cs:line 22
   at Conduit.CPServices.Logic.HtmlContentMonitor.HtmlContentManager.FetchRootAndExternlContentAsByteArray(Url rootUrl) in D:\Conduit\RnD\Server\Services\CP\CPServices\Logic\HtmlContentMonitor\Conduit.CPServices.Logic.HtmlContentMonitor\HtmlContentManager.cs:line 112
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:16:50+00:00Added an answer on May 31, 2026 at 9:16 pm

    This is a bug in HtmlAgilityPack which could be caught e.g. if document encoding set through the <META> tag is invalid (e.g. <META http-equiv="Content-Type" content="text/html; charset=8859-9">). As Simon Mourier said, this is a bug introduced in 1.4.0.0.

    See the answer to the similar error: The HAL internals tries to get an appropriate encoding for this string by using something like Encoding.GetEncoding("8859-9") and this throws an error.

    To avoid this set the encoding manually, e.g.:

    web.Load(rootUrl.Value, Encoding.GetEncoding("iso-8859-9"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a thread that executes the following code: public void run() { try
Consider the following code public static void method(String[] srgs){ try{ }catch(){ System.out.println(Hello World +
when I run a following code Runnable r = new Runnable() { @Override public
I have the following code: public static void main(String[] args) { try { int
When I try to run the following code (two separated assemblies) ClassLibrary.cs public interface
When I try to run the following code (from the REPL) in Clojure: (dotimes
I try to run jsf application in myeclipse using jboss web server and following
Consider the following code :- public class UsingWait1{ public static void main(String... aaa){ CalculateSeries
I am using the following code to show dynamic progress dialog : public void
I use NetBeans 6.5. When I try to run the following code: package com.afrikbrain.numeroteur16;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.