private void WriteConsumerMap(JsonWriter writer, bool failedPipDirectDepsOnly) { writer.WriteStartArray(); foreach (var item in m_fileToConsumerMap .Select(kvp => new KeyValuePair <AbsolutePath, int>(kvp.Key, failedPipDirectDepsOnly ? kvp.Value.Intersect(m_failedPips).Count() : kvp.Value.Count)) .OrderByDescending(kvp => kvp.Value) .Take(50)) { writer.WriteStartObject(); writer.WritePropertyName("ConsumerCount"); writer.WriteValue(item.Value); writer.WritePropertyName("Path"); writer.WriteValue(item.Key.ToString(PathTable)); writer.WriteEndObject(); } writer.WriteEndArray(); }