The ModuloObjectHashcode managed debugging assistant (MDA) changes the behavior of theclass to perform a modulo operation on the hash code returned by the method. The default modulus for this MDA is 1, which causes GetHashCode to return 0 for all objects.
After moving to a new version of the common language runtime (CLR), a program no longer executes properly:
The program is getting the wrong object from a.
The order of enumeration from a Hashtable has a change that breaks the program.
Two objects that used to be equal are no longer equal.
Two objects that used to not be equal are now equal.
Your program may be getting the wrong object from a Hashtable because the implementation of themethod on the class for the key into the Hashtable tests for equality of objects by comparing the results of the call to the GetHashCode method. Hash codes should not be used to test for object equality because two objects may have the same hash code even if their respective fields have different values. These hash code collisions, although rare in practice, do occur. The effect this has on a Hashtable lookup is that two keys which are not equal appear to be equal, and the wrong object is returned from the Hashtable. For performance reasons, the implementation of GetHashCode can change between runtime versions, so collisions that might not occur on one version might occur on subsequent versions. Enable this MDA to test whether your code has bugs when hash codes collide. When enabled, this MDA causes the GetHashCode method to return 0, resulting in all hash codes colliding. The only effect enabling this MDA should have on your program is that your program runs slower.
The order of enumeration from a Hashtable may change from one version of the runtime to another if the algorithm used to compute the hash codes for the key change. To test whether your program has taken a dependency on the order of enumeration of keys or values out of a hash table, you can enable this MDA.
The modulus attribute specifies the modulus used on the hash code. The default value is 1.
<mdaConfig> <assistants> <moduloObjectHashcode modulus="1" /> </assistants> </mdaConfig>