Is the instance variable 'this.loadFactor' by any chance of integer type?
Regards, Bernardo van der Wal On Jul 26, 2011 5:01 AM, "Ben Pryor" <[email protected]> wrote: > I sometimes get this exception (mono 2.8) - running fully bundled (exe + > deps). It happens very rarely. 64 bit suse system. > > How is this exception possible? > > Stack Trace: > at System.Collections.Hashtable..ctor (Int32 capacity, Single > loadFactor, IHashCodeProvider hcp, IComparer comparer) [0x00000] in > <filename unknown>:0 > at System.Collections.Hashtable..ctor (Int32 capacity, Single > loadFactor) [0x00000] in <filename unknown>:0 > at System.Collections.Hashtable..ctor (Int32 capacity) [0x00000] in > <filename unknown>:0 > at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider > obj, System.Type attributeType, Boolean inherit) [0x00000] in <filename > unknown>:0 > at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider > obj, Boolean inherit) [0x00000] in <filename unknown>:0 > at System.Reflection.MonoField.GetCustomAttributes (Boolean inherit) > [0x00000] in <filename unknown>:0 > > > Code from hashtable: > > public Hashtable (int capacity, float loadFactor, IHashCodeProvider hcp, > IComparer comparer) { > if (capacity<0) > throw new ArgumentOutOfRangeException > ("capacity", "negative capacity"); > if (loadFactor < 0.1f || loadFactor > 1.0f || > Single.IsNaN (loadFactor)) > throw new ArgumentOutOfRangeException > ("loadFactor", "load factor"); > if (capacity == 0) ++capacity; > this.loadFactor = 0.75f*loadFactor; > double tableSize = capacity / this.loadFactor; > if (tableSize > Int32.MaxValue) > throw new ArgumentException ("Size is too > big"); > int size = (int) tableSize; > size = ToPrime (size); > this.SetTable (new Slot [size], new int [size]); > this.hcp = hcp; > this.comparer = comparer; > this.inUse = 0; > this.modificationCount = 0; > } > The only divide in there is is a float divide. It wouldn't try to convert > 'this.loadFactor' to an int and then do int divide would it? > > Thanks
_______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
