Bug Report
System.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.
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"
Description
I get the error "Failed to load file or assembly" during application launch
Steps to Reproduce Error occurs when starting the application
Environment details: [OS, .NET Runtime, ...]
Win 7x64.
VS - 2017
.NET Framework 4.6.1
Code
using AngleSharp.Html.Parser;
namespace rsh
{
class Parser_test
{
HtmlParser domParser;
public Parser_test()
{
domParser = new HtmlParser();
}
}
}
I installed:
"System.Text.Encoding.CodePages".
Error remained.
Additional reasoning - link
Pic.1
Update-1
Based on - stackoverflow.com/a/40775352/10530657
Completed
Update-Package -reinstall
.
Closed, opened Visual Studio.
Opened in Visual Studio 2015.
No result.
Update-2
Installed "AngleSharp - 0.9.11".
The error is gone.
Update-3
Installed - System.Text.Encoding.CodePages
Pic.5
Update-4
Collected the console project,
The project gives an error.
Maybe someone will have the opportunity to check on their side.
Or send me a project that works.
Maybe this will help identify the cause of the error.
The project is made on the basis of documentation "AngleSharp"- documentation . link
Link to the project - link
Question
How to make the error not appear in "AngleSharp - 0.10.01"?
i had the same problem
your project > rightClick > manage nuget packages >
search : System.Text.Encoding.CodePages
install that .
long:
anglesharp nuget details:
.net framework 4.6 requires "System.Text.Encoding.CodePages".
just installing angleSharp, doesn't install the required package automatically. you need to install from nuget package manager.
I had the same exception, and it took me a few minutes to realize....
If you have AngleSharp in a class library, you also need to install it in whatever is consuming the class library.
Oops.
User contributions licensed under CC BY-SA 3.0