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.

`InvalidOperationException` due to failing `VerifyIntegrity`

See original GitHub issue

Our Web Server code uses AngleSharp to do various HTML cleanup and Colourization. Today we start to get InvalidOperationExceptions on only 1 of our 6 servers From the stack trace, it looks like something might be missing some error handling.


Exception of type ‘System.InvalidOperationException’ was thrown.

at System.Runtime.CompilerServices.ConditionalWeakTable`2.VerifyIntegrity()
at System.Runtime.CompilerServices.ConditionalWeakTable`2.TryGetValue(TKey key, TValue& value)
at System.Runtime.CompilerServices.ConditionalWeakTable`2.GetValue(TKey key, CreateValueCallback createValueCallback)
at AngleSharp.Css.StyleAttributeObserver.AngleSharp.Dom.IAttributeObserver.NotifyChange(IElement host, String name, String value)
at AngleSharp.Dom.Element.SetupElement()
at AngleSharp.Html.Dom.HtmlImageElement.SetupElement()
at AngleSharp.Html.Parser.HtmlDomBuilder.CloseCurrentNode()
at AngleSharp.Html.Parser.HtmlDomBuilder.InBodyStartTagBreakrow(HtmlTagToken tag)
at AngleSharp.Html.Parser.HtmlDomBuilder.InBodyStartTag(HtmlTagToken tag)
at AngleSharp.Html.Parser.HtmlDomBuilder.Parse(HtmlParserOptions options)
at AngleSharp.Html.Parser.HtmlParser.Parse(HtmlDocument document)
at CodeProject.Modules.Articles.Article.get_FormattedContent()

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
matthewDDenniscommented, Dec 14, 2020

FYI, I’ve eliminated all code that could cause Thread Aborts and the issue has not been observed since.

1reaction
matthewDDenniscommented, Nov 24, 2020

I though you might be using the same value for multiple IDocuments based on the implementation of Document.Equals.

I’ve tracked down how the CWT is being corrupted.
When we load an Article for display, we use AngleSharp to format/sanitize the HTML content of the article if it hasn’t been cached recently. There are a few pages that load a lot of Articles, and under high load, these pages are timing out, usually in the formatting methods. When a page times out, it throws a ThreadAbortException, and because of where the code is executing there is a better chance than average of the exception being thrown while in the CWT code, causing the CWT corruption.

This may be causing issues in other libraries we are using, and I am investigating, Probably will need to write a Tip/Article about this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - InvalidOperationException in my Lazy<> value factory
It turned out that this error only occurred when trying to inspect the Value property of the Lazy<> in the Visual Studio debugger....
Read more >
Major Install Problem With VS Community 2019 (or 2017) ...
Error: Unable to verify the integrity of the installation files: the certificate could not be verified. VisualStudio Bootstrapper:25/01/2021 11: ...
Read more >
Verify Integrity of Game Files
One or more files may fail to verify. This is normal for most Steam games. The files that fail to verify are local...
Read more >
System.InvalidOperationException
Goto My Library on Steam. Right-Click Terraria and Select Properties. Goto Local Files Tab. Now Select Verify Integrity of Game Cache. If you ......
Read more >
Package installation keeps failing - Something Else
The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the...
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