Repository: vscode
Issue: Problems tab errors claim background preLaunchTask has errors
Labels: bug,debug

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.87.2 (user setup)
- OS Version: Windows 10 x64 - 22H2 (OS Build 19045.4046)

Error behavior:

When errors are present in the Problems tab from unrelated open files, any background preLaunchTask will finish while claiming it had errors and show a message box stating as such:
```
Error exists after running preLaunchTask '<TaskName>'.
```
![image](https://github.com/microsoft/vscode/assets/9752430/23f65ef9-5b87-433a-b808-3b39e8012b45)

Expected behavior:

Sometimes these errors may be incorrectly shown by an extension, or in this case, simply using JSONC syntax in a JSON file because your project may happen to support that. In any scenario, these errors may have nothing to do with the launch configuration being run, and it *certainly* is not an error in the preLaunchTask specifically like VSCode claims. So the preLaunchTask is expected to run without showing this message box when no problems are detected by the task itself.

Other information:

* There were no errors showing up in the developer console when running the launch configuration.
* Extensions can be disabled temporarily before testing this, but opening a folder in VSCode re-enables them, so they need to be disabled manually (then reload the window).
* This issue can occur both on Windows, and from within a WSL2 Ubuntu Docker dev container (and probably other places too).
* Further testing shows that this can *only* be triggered for the background problem matcher. Creating a normal pattern that does match will not complain about errors after the task finishes naturally.

Steps to reproduce:


1. Open an empty folder in VSCode and create the files shown below.
2. Make sure **problem.json** is open in the editor, and that it highlights an error in the Problems tab due to the comment.
3. Run the **PreLaunchTask Test** launch configuration.
4. After a second, VSCode will show a message claiming the preLaunchTask had errors (the moment the background problem matcher ended).
5. Remove the comment in **problem.json** or close the file and make sure its problem disappears from the Problems tab.
6. Run the launch configuration again, and it should run without error (like is expected).

Files needed to reproduce:

**.vscode/launch.json:**
```json
{
  "version": "0.2.0",
  "configurations": [{
    "name": "PreLaunchTask Test",
    "type": "node-terminal",
    "request": "launch",
    "command": "sleep 1; exit",
    "preLaunchTask": "Background Task"
  }]
}
```

**.vscode/tasks.json:**
```json
{
  "version": "2.0.0",
  "tasks": [{
    "label": "Background Task",
    "type": "shell",
    "command": "echo \"Preparing...\"; sleep 1; echo \"Ready\"; sleep 5",
    "isBackground": true,
    "problemMatcher": {
      "pattern": { "regexp": "", "file": 0, "location": 0, "message": 0 },
      "background": {
        "activeOnStart": true,
        "beginsPattern": "Preparing",
        "endsPattern": "Ready"
      }
    }
  }]
}
```

**problem.json:**
```json
{
  // This is a problem
}
```