diagnostic_hotspots

[diagnostics]

Groups diagnostics into hotspots by file, project, category, or ID so you can plan cleanup before drilling into raw diagnostics.

Try this tool in Playground.

Parameters

NameTypeRequiredDescription
filePathstringNoOptional file path filter.
projectNamestringNoOptional project name filter.
diagnosticSourcestringNoDiagnostic source: 'compiler' (default), 'all', or 'analyzer'.
severitystringNoMinimum severity: 'error', 'warning', 'info', or 'hidden'. Default is 'warning'.
categorystringNoOptional category filter (e.g., 'Compiler', 'Style').
idPrefixstringNoOptional diagnostic ID prefix filter (e.g., 'CS', 'CA', 'IDE').
groupBystringNoPrimary grouping: 'file' (default), 'project', 'category', or 'id'.
includeExamplesbooleanNoInclude example diagnostics inside each hotspot group. Default is false.
maxExamplesPerGroupnumberNoMaximum example diagnostics to include per group when includeExamples=true. Default is 3. Use 0 for none.
pathStylestringNoPath style: 'absolute' (default) or 'relative' (to solution root).
sortBystringNoOptional sort: 'count' (default), 'errorCount', 'warningCount', 'infoCount', or 'key'.
sortOrderstringNoSort order: 'desc' (default) or 'asc'.
skipnumberNoPagination offset. Default is 0.
takenumberNoPagination size. Default is 50.

Examples

Group compiler diagnostics by file

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "diagnostic_hotspots",
    "arguments": {
      "groupBy": "file"
    }
  }
}
Response
{
  "success": true,
  "data": {
    "groupBy": "file",
    "groupCount": 1,
    "paging": {
      "skip": 0,
      "take": 50,
      "returned": 1,
      "total": 1
    },
    "groups": [
      {
        "key": "/path/to/UserService.cs",
        "totalCount": 4,
        "errorCount": 1,
        "warningCount": 3,
        "infoCount": 0,
        "examples": [
          {
            "id": "CS8602",
            "severity": "Warning",
            "lineNumber": 42,
            "message": "Dereference of a possibly null reference."
          }
        ]
      }
    ]
  },
  "error": null
}

Show analyzer hotspots with examples

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "diagnostic_hotspots",
    "arguments": {
      "diagnosticSource": "analyzer",
      "groupBy": "category",
      "includeExamples": true
    }
  }
}
Response
{
  "success": true,
  "data": {
    "groupBy": "file",
    "groupCount": 1,
    "paging": {
      "skip": 0,
      "take": 50,
      "returned": 1,
      "total": 1
    },
    "groups": [
      {
        "key": "/path/to/UserService.cs",
        "totalCount": 4,
        "errorCount": 1,
        "warningCount": 3,
        "infoCount": 0,
        "examples": [
          {
            "id": "CS8602",
            "severity": "Warning",
            "lineNumber": 42,
            "message": "Dereference of a possibly null reference."
          }
        ]
      }
    ]
  },
  "error": null
}

Response Notes

Returns grouped diagnostic hotspots with severity totals and optional example diagnostics