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)

Posts

  • 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.