This is a Delphi error. TDictionary<TKey,TValue>.ExtractPair does not assign Result .
RRUZ detected an error in QC .
The code reads:
function TDictionary<TKey,TValue>.ExtractPair(const Key: TKey): TPair<TKey,TValue>; var hc, index: Integer; begin hc := Hash(Key); index := GetBucketIndex(Key, hc); if index < 0 then Exit(TPair<TKey,TValue>.Create(Key, Default(TValue))); DoRemove(Key, hc, cnExtracted); end;
Result must be assigned when calling DoRemove .
It is very difficult to get around this error. ExtractPair is the only way to get an element from the dictionary without destroying the key, and therefore you must call it. But since it will not return the extracted element, you need to read the element first, remember the value, and then call ExtractPair .
source share