Repository: vscode
Issue: npm.packageManager=auto incorrectly assumes yarn as package manager for running tasks
Labels: bug,tasks

Type: <b>Bug</b>

I have a fairly standard PNPM project, for which I have configured a few VSCode tasks:
```
{
	"version": "2.0.0",
	"tasks": [
		{
			"label": "bar",
			"type": "npm",
			"script": "bar"
		}
	]
}
```
When VSCode is set with `npm.packageManager=auto`, it incorrectly assumes that tasks should be run using `yarn`.
Since the project uses [corepack ](https://nodejs.org/api/corepack.html) and specifies a packageManager in `package.json`, using yarn results in an error:

```
* Executing task in folder foo: yarn run bar 
Usage Error: This project is configured to use pnpm
$ yarn ...
 *  The terminal process "cmd.exe /d /c yarn run bar" terminated with exit code: 1. 
```

This for me doesn't make much sense, because:
- in the project folder there is a `package.json`, configured with `"packageManager": "pnpm@7.9.3"` (using corepack)
- in the project folder there is a `pnpm-lock.yaml` and a `pnpm-workspace.yaml` files, which should correctly hint to the right package manager
- there is no trace of a `yarn.lock` or any other yarn-specific files or configurations.
- yarn is installed globally (via corepack shims) but so is npm and pnpm
 
If the auto detection for PNPM failed, I'd expect to at least fallback to NPM.
Using `npm.packageManager=pnpm` of course works fine.



VS Code version: Code - Insiders 1.75.0-insider (6ed4d436a9b6ae131732f4e2a723868231f4473a, 2022-12-23T05:21:57.802Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Sandboxed: Yes

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i5-7600 CPU @ 3.50GHz (4 x 3504)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_renderer: enabled_on<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|undefined|
|Memory (System)|15.95GB (5.19GB free)|
|Process Argv|..\\cronicle\\ --crash-reporter-id 2a3507f6-d0a2-424d-8827-2b26df7c63ff|
|Screen Reader|no|
|VM|0%|
</details><details><summary>Extensions (5)</summary>

Extension|Author (truncated)|Version
---|---|---
vscode-eslint|dba|2.2.6
gitlens-insiders|eam|2022.12.2304
intellicode-api-usage-examples|Vis|0.2.6
vscodeintellicode|Vis|1.2.29
markdown-all-in-one|yzh|3.5.0


</details><details>
<summary>A/B Experiments</summary>

```
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30422396
pythontb:30258533
vsc_aacf:30263846
pythonptprofiler:30281269
vsdfh931:30280409
vshan820:30294714
pythondataviewer:30285072
vscod805cf:30301675
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30404738
cppdebug:30492333
vsclangdf:30492506
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30618038
pylantcb52:30590116
pyindex848:30611229
nodejswelcome1:30587009
pyind779:30611226
vscrpc:30624061
pythonsymbol12cf:30622697
fim-prod:30623723

```

</details>

<!-- generated by issue reporter -->