Hi Gary,
I did a search on Google for "Load factor too high" as well and there
was just a single reference.
http://dotnet.di.unipi.it/Content/ss...bcl/hashtable_
8cs-source.html
This took me to the source code for an implementation of Hastable.
The top of the file started with: [some lines omitted]
00004 // Copyright (c) 2002 Microsoft Corporation. All rights
reserved.
00005 //
00006 // The use and distribution terms for this software are
contained in the file
00007 // named license.txt, which can be found in the root of this
distribution.
00008 // By using this software in any fashion, you are agreeing to
be bound by the
00009 // terms of this license.
00010 //
00017 ** Class: Hashtable
00021 ** Purpose: Hash table implementation
00023 ** Date: September 25, 1999
00024 **
Somewhere down inside is the function that you are calling when you
assign to the hashtable.
00711 // Inserts an entry into this hashtable. This method is
called from the Set
00712 // and Add methods. If the add parameter is true and the
given key already
00713 // exists in the hashtable, an exception is thrown.
00714 private void Insert (Object key, Object nvalue, bool
add) {
00715 if (key == null) {
00716 throw new ArgumentNullException("key",
Environment.GetResourceString("ArgumentNull_Key")) ;
00717 }
At at the end of the function it says: [Caps added]
00777
00778 // If you see this assert, make sure load
factor & count are reasonable.
00779 // Then verify that our double hash function (h2,
described at top of file)
00780 // meets the requirements described above. YOU
SHOULD NEVER SEE THIS ASSERT.
00781 BCLDebug.Assert(false, "hash table insert failed!
Load factor too high, or our double hashing function is incorrect.");
00782 throw new
InvalidOperationException(Environment.GetResourceS tring
("InvalidOperation_HashInsertFailed"));
00783 }
Now, the error message isn't <exactly> like yours but it looks mighty
suspicious, doesn't it?
In which case the answer is, yes, set your loadfactor and initial
capacity. And who can dispute that it's a framework bug - they seem to
say so themselves!!
Note. There are no properties to determine the load factor or capacity
(number of buckets), but these are clearly visible if you stick your
Hashtable into a Watch - loadFactor, buckets.Length.
The documentation says 1.0 for initial load factor. I found that it
was 0.72 in .NET 1.0.3705
Regards,
Fergus