'System.ArgumentException' in System.Private.CoreLib.dll
See original GitHub issueHi, first of all, thank you for the great library.
Description
I’m using AngleSharp 0.16.0. When I try to parse HTML string, I get a “‘System.ArgumentException’ in System.Private.CoreLib.dll” exception in the output. The parsing and DOM manipulation seem to be working fine.
Am I doing something wrong?
Thank you in advance.
Steps to Reproduce
string html = @"<p>some html</p>";
public MainWindow()
{
InitializeComponent();
Task.Run(() => StripStyleAttributes(html));
}
private async Task<string> StripStyleAttributes(string s)
{
try
{
var context = BrowsingContext.New(Configuration.Default);
var document = await context.OpenAsync(req => req.Content(s));
var ItemsLinq = document.All.Where(m => m.HasAttribute("style"));
foreach (var item in ItemsLinq)
{
item.RemoveAttribute("style");
}
return document.DocumentElement.InnerHtml;
}
catch (Exception e)
{
// This does not trigger.
Debug.WriteLine("Exception: " + e.Message);
return "";
}
}
Environment details: Windows 10, x64 Visual Studio Version 16.10.1 WPF with .NET5
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
c# - Exception thrown: 'System.ArgumentException' in ...
Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll: ''windows-1252' is not a supported encoding name [duplicate].
Read more >An exception of type 'System.ArgumentException' occurred ...
An exception of type 'System.ArgumentException' occurred in System.Private.CoreLib.dll but was not handled in user code #974.
Read more >How can i make VS stop on all exceptions.
ArgumentException' in System.Private.CoreLib.dll. Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll.
Read more >What is System.Private.CoreLib.dll and why is it giving me ...
Background: Building for UWP, the app uses the REST client for Azure at https://github.com/Unity3dAzure/RESTClient.
Read more >System.ArgumentException during startup #5612
Private.CoreLib.dll System.ArgumentException: 'Null is not a valid constant value for this type.' I'm trying to debug the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh I see, you enabled the “Just My Code” option in Visual Studio. I did that too and the exception disappeared.
https://docs.microsoft.com/en-us/visualstudio/debugger/just-my-code
Here is mine.