Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Little Dictionary Issue

EkkehardBeierEkkehardBeier DEUniversity ✭✭
edited October 2013 in Xamarin.iOS

Hi all,

I've a string-based (key) dictionary. Sometimes (very randomly) I get a bad index exception when setting an entry.


class ComposedImageMap : Dictionary <string, ComposedImage.ComposedImageVersion> {}


Stack waitingImages = new Stack ();

ComposedImageMap images = new ComposedImageMap ();


try {

this.waitingImages.Push (tImageKey);

this.images [tImageKey] = version;

} catch (System.IndexOutOfRangeException e) {

// fires then...


In my understanding, setting a value either creates an entry for the specific key or overrides an existing one...

Any hints are appreciated...

Ekki (Xamarin.iOS 4.0.13 #38)


  • JasonAwbreyJasonAwbrey USInsider, University, Developer Group Leader mod

    It may be a threading issue. Have you tried using ConcurrentDictionary instead?

  • EkkehardBeierEkkehardBeier DEUniversity ✭✭

    This actually seemed to solve the issue! Thanks a lot!

Sign In or Register to comment.