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.

ArgumentOutOfRangeException from Browser.TaskEventLoop

See original GitHub issue

Bug Report

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version of AngleSharp?
  • ~Did you check the FAQs to see if that helps you?~ don’t see any FAQ in readme/wiki
  • Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Css for CSS support)
  • Did you perform a search in the issues?

~For more information, see the CONTRIBUTING guide.~ no such file

Description

I got following unexpected exception from thread pool during tests debugging:

mscorlib.dll!System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument argument, System.ExceptionResource resource) Line 93	C#
 	mscorlib.dll!System.ThrowHelper.ThrowArgumentOutOfRangeException() Line 57	C#
 	mscorlib.dll!System.Collections.Generic.List<AngleSharp.Dom.Node>.this[int].get(int index) Line 181	C#
 	AngleSharp.dll!AngleSharp.Dom.NodeList.this[int].get(int index)	Unknown
 	AngleSharp.dll!AngleSharp.Dom.NodeList.AngleSharp.Dom.INodeList.get_Item(int index)	Unknown
 	AngleSharp.dll!AngleSharp.Dom.NodeExtensions.FindChild<AngleSharp.Html.Dom.HtmlHtmlElement>(AngleSharp.Dom.INode parent)	Unknown
 	AngleSharp.dll!AngleSharp.Html.Dom.HtmlDocument.DocumentElement.get()	Unknown
 	AngleSharp.dll!AngleSharp.Dom.Document.Body.get()	Unknown
 	AngleSharp.dll!AngleSharp.Dom.Document.RaiseLoadedEvent()	Unknown
 	AngleSharp.dll!AngleSharp.Browser.EventLoopExtensions.Enqueue.AnonymousMethod__0(System.Threading.CancellationToken c)	Unknown
 	AngleSharp.dll!AngleSharp.Browser.TaskEventLoop.TaskEventLoopEntry.Run.AnonymousMethod__0()	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.InnerInvoke() Line 2875	C#
 	mscorlib.dll!System.Threading.Tasks.Task.Execute() Line 2499	C#
 	mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj) Line 2861	C#
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 955	C#
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 902	C#
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot) Line 2827	C#
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution) Line 2757	C#
 	mscorlib.dll!System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() Line 2703	C#
 	mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Line 820	C#
 	mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() Line 1161	C#
 	[Native to Managed Transition]	


Steps to Reproduce

  1. no idea

Expected behavior: no unexpected exceptions and no hidden event loops because I use anglesharp only as HTML/CSS parser and don’t expect any runtime features like event-loop enabled with such scenario

Actual behavior: exception from browser event loop when I don’t use any runtime features - just parser

Environment details: [windows, .net 4.7.1]

Possible Solution

Maybe I didn’t noticed some knob to disable this functionality.

Checking document on stack I see that it is “about:blank” document and failed NodeList is empty. Have no idea from where this code was initiated and why, because my usecase for angle# is just:

_document = new HtmlParser().ParseDocument(markup);
// traverse dom with QuerySelectorAll and replace/update some nodes

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
FlorianRapplcommented, May 15, 2019

Landed in devel

0reactions
FlorianRapplcommented, May 15, 2019

The TaskEventLoop will be removed from 0.13. By default, no event loop (sync emission of events) will be used.

In AngleSharp.Js another (optional) event loop will be provided, which allocates a dedicated thread and provides higher performance and reliability.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to prevent unobserved exceptions? #698
Hi there. I'm using AngleSharp 0.9.10. The following page includes a css value that results in an integer overflow, and I'm trying to...
Read more >
ArgumentOutOfRangeException Class (System)
The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked...
Read more >
ArgumentOutOfRangeException Constructor (System)
Initializes a new instance of the ArgumentOutOfRangeException class with the parameter name, the value of the argument, and a specified error message.
Read more >
C# Exception Guide: ArgumentOutOfRangeException
The ArgumentOutOfRangeException exception is thrown when the argument passed to a method is not null and contains a value that is not within ......
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