The bug happens because we have a logic to test for esriIdentifyTopmost.esriIdentifyTopmost inherently means that we are really interested in the top most layer only.When we do the identify operation, we shall loop through all layers to exact all find results. However, if it is only the topmost layer that we are interested in, after collecting result for the first layer, we could just stop identifying.However, we test the top layer condition prior to testing whether the maxRecordCount has been reached. Hence in a situation where only we are interested in the topmost layer and there are more than maxRecordCount number of records there, the testing of maxRecordCount part is ignored.