AngleSharp: InvalidOperationException

I know that it is hard to fix issue when it is not reproducible but this is one of that case where i can not reproduce this error. Our crawler works 2-3 days and stop permanently and gives below exception. I have to restart application when this is happened.

AngleSharp version is 9.9. .Net version is 4.6.1

Let me know if is there anything you need to know more.

System.InvalidOperationException: Exception of type 'System.InvalidOperationException' was thrown.
   at System.Runtime.CompilerServices.ConditionalWeakTable`2.VerifyIntegrity()
   at System.Runtime.CompilerServices.ConditionalWeakTable`2.Add(TKey key, TValue value)
   at AngleSharp.Dom.Node..ctor(Document owner, String name, NodeType type, NodeFlags flags)
   at AngleSharp.Dom.Document..ctor(IBrowsingContext context, TextSource source)
   at AngleSharp.Dom.Html.HtmlDocument.<LoadAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AngleSharp.BrowsingContextExtensions.<OpenAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NinjaSpider.Engine.WebsiteCrawler.<GetHtmlDocumentAsync>d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NinjaSpider.Engine.WebsiteCrawler.<GetPageInfoAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NinjaSpider.Engine.SpiderQueue.<CrawlPageAsync>d__19.MoveNext() 

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Nothing special. Just use “using”:

using(IDocument document = await BrowsingContext.New().OpenAsync(r => r.Address(uri).Content(content)))
{
}