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.

Index was outside the bounds of the array

See original GitHub issue

Suddenly getting this a lot

    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
    at AngleSharp.Dom.Element.GetOrCreateCallback(Type type)
    at AngleSharp.Dom.Element.RegisterCallback[TElement](String name, Action`2 callback)
    at AngleSharp.Dom.Html.HtmlStyleElement..cctor()

We’ve also seen it in conjunction with a call from HtmlSanitiser

  at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at AngleSharp.Dom.Element.GetOrCreateCallback(Type type)
   at AngleSharp.Dom.Element.AttributeChanged(String localName, String namespaceUri, String oldValue, String newValue)
   at AngleSharp.Dom.Collections.NamedNodeMap.SetNamedItemWithNamespaceUri(IAttr item, Boolean suppressMutationObservers)
   at Ganss.XSS.HtmlSanitizer.DoSanitize(IHtmlDocument dom, IElement context, String baseUrl)
   at Ganss.XSS.HtmlSanitizer.Sanitize(String html, String baseUrl, IMarkupFormatter outputFormatter)

and

   at AngleSharp.Services.Default.HtmlElementFactory.<>c.<.ctor>b__3_39(Document document, String prefix)
   at AngleSharp.Services.Default.HtmlElementFactory.Create(Document document, String localName, String prefix)
   at AngleSharp.Parser.Html.HtmlDomBuilder.AddElement(HtmlTagToken tag, Boolean acknowledgeSelfClosing)
   at AngleSharp.Parser.Html.HtmlDomBuilder.InRow(HtmlToken token)
   at AngleSharp.Parser.Html.HtmlDomBuilder.Parse(HtmlParserOptions options)
   at AngleSharp.Parser.Html.HtmlDomBuilder.ParseFragment(HtmlParserOptions options, Element context)
   at AngleSharp.Dom.DocumentFragment..ctor(Element context, String html)
   at AngleSharp.Dom.Element.set_InnerHtml(String value)

Unfortunately I’ve been unable to replicate it in the debugger: the error is only in our logs (but we have hundreds of them)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:17 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
FlorianRapplcommented, Dec 8, 2016

Yes, that is true - once the dictionary is broken it is dead. Also I did not say I won’t fix it - just that the proposed fix won’t work and will not be implemented. I think the dictionary will be rather removed with v0.10 - there will be another (potentially a little bit less performing, but more flexible) way that also does not rely on a static component.

0reactions
FlorianRapplcommented, Jul 15, 2017

It’s not that simple, unfortunately. Yes, potentially it is little effort, but right now I cannot spend minutes to hours figuring out what changes are needed. That blocked another PR already and it will for sure prevent a new build on v0.9.9. Hence the build for AppVeyor still needs to be fixed before releasing it.

Maybe someone knows the answer already and can contribute.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error : Index was outside the bounds of the array. [duplicate]
It means postStatus will contain 8 elements from index 0 to 7.
Read more >
How to Fix the Array Index Out Of Bounds Exception in Java
The ArrayIndexOutOfBoundsException is a runtime exception in Java that occurs when an array is accessed with an illegal index.
Read more >
Assign : Index was outside the bounds of the array - Help
to give a bit more detail this error occurs when you are trying to access an index outside of the current bounds of...
Read more >
Was Outside the Bounds of the Array: An In-depth Guide
The index was outside the bounds of the array Visual Studio bug is caused when your document has declared arrays that cannot store...
Read more >
Index outside bounds of array error - Excel
This issue occurs when one of the selected table names ends with a string that matches a schema name in the database. 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