question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HtmlParser. Failed to load file or assembly

See original GitHub issue

Bug Report

ystem.TypeInitializationException   HResult = 0x80131534   Message = Initializer type “AngleSharp.Configuration” threw an exception.   Source = AngleSharp   Stack trace:    in AngleSharp.Configuration.get_Default ()    in AngleSharp.BrowsingContext.NewFrom [TService] (TService instance)    in AngleSharp.Html.Parser.HtmlParser…ctor ()    in rsh.Parser_test…ctor () in Z: \ vs \ csharp \ prb \ rsh \ rsh \ Parser_test.cs: line 19    in rsh.Form1…ctor () in Z: \ vs \ csharp \ prb \ rsh \ rsh \ Form1.cs: line 18    in rsh.Program.Main () in Z: \ vs \ csharp \ prb \ rsh \ rsh \ Program.cs: line 19

Internal exception 1: FileNotFoundException: Failed to load file or assembly “System.Text.Encoding.CodePages, Version = 4.0.2.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a” or one of their dependencies. Cannot find the specified file.

Prerequisites

no or don’t know

  • Can you reproduce the problem in a MWE? no

  • Are you running the latest version of AngleSharp? Version - 0.10.1

  • Did you check the FAQs to see if that helps you? used google search. did not help

  • Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Css for CSS support) see screen

  • Did you perform a search in the issues? Searched for phrase: “Failed to load file or assembly”

For more information, see the CONTRIBUTING guide.

Description

I get the error “Failed to load file or assembly” during application launch

Steps to Reproduce

Error occurs when starting the application

Expected behavior: [What you expected to happen]

Actual behavior: [What actually happened]

Environment details: [OS, .NET Runtime, …] Win 7x64. VS - 2017 .NET Framework 4.6.1

Possible Solution


[Optionally, share your idea to fix the issue]

Code

using AngleSharp.Html.Parser;

namespace rsh
{
    class Parser_test
    {
        HtmlParser domParser;
       
        public Parser_test()
        {
            domParser = new HtmlParser();
        }

    }
}

2019-01-15_09-34-27 2019-01-15_09-43-20

Installation

  • I installed AngleSharp on the following principle mspaint_2019-01-15_10-38-22

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
FlorianRapplcommented, Jan 15, 2019

You need to install the peer dependency System.Text.Encoding.CodePages (as the error suggested, potentially it is a language barrier; sorry for that).

0reactions
FlorianRapplcommented, Jan 15, 2019

HTH = Hope that helps

I don’t see any “swearing” but I have a feeling there is a language barrier at work here.

As stated AngleSharp 0.10.1 has a peer dependency (like 0.10.x) to the given package. So I wonder why you think this is a valid question or why you think any behavior of 0.9.x should be relevant to 0.10.x? Its a new major release and it is breaking (please read the migration guide). Thanks and sorry for the inconvenience!

Read more comments on GitHub >

github_iconTop Results From Across the Web

HtmlParser. Failed to load file or assembly
I just created a new console application, installed the AngleSharp package (0.10.1) and copy/pasted the "First Steps" code from this page. I got ......
Read more >
Azure Functions - Could not load file or assembly System. ...
This post is about how to fix the exception Could not load file or assembly System.Text.Encoding.CodePages when you're using any HTML parser ......
Read more >
Could not load type 'iTextSharp.text.html.HtmlParser' from ...
As I am getting error like this. Could not load type 'iTextSharp.text.html.HtmlParser' from assembly 'itextsharp, Version=5.0.6.0, ...
Read more >
HTMLParser throws Error parsing configuration file or file is ...
Error parsing configuration file or file is missing error thrown when using HTMLParser. ... Could not load file or assembly or one of...
Read more >
The type initializer for 'Ganss.XSS.HtmlSanitizer' threw an ...
HtmlParser ' from assembly 'AngleSharp, Version=0.9.9.0, ... Could not load file or assembly 'AngleSharp' or one of its dependencies.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found