Vscode-cpptools: The task provider for "C/C++" tasks unexpectedly provided a task of type "shell".

Created on 30 Apr 2020  路  51Comments  路  Source: microsoft/vscode-cpptools

VSCode version:

1.45.0-insider
a0fe37870c42e0704a492cdc6b8550b4cf23f63c
x64

vscode-cpptools version: 0.28.0-insiders

Here is my tasks.json.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "gen",
            "type": "shell",
            "command": "cmake",
            "args": [
                "-DCMAKE_BUILD_TYPE=DEBUG",
                ".."
            ],
            "options": {
                "cwd": "build"
            }
        },
        {
            "label": "make",
            "type": "shell",
            "command": "make",
            "args": [

            ],
            "group": {
                "kind": "test",
                "isDefault": true
            },
            "dependsOn": "gen",
            "options": {
                "cwd": "build"
            }
        },
        {
            "label": "run",
            "type": "shell",
            "command": "./build/infidungeon",
            "args": [

            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "dependsOn": "make"
        }
    ]
}

If I change my code, or otherwise sometimes completely randomly, when I run task run, I get this message:
image
And when I hit, "Show output" I see:

The task provider for "C/C++" tasks unexpectedly provided a task of type "shell".
The task provider for "C/C++" tasks unexpectedly provided a task of type "shell".

Is something wrong with my tasks.json? I can't replicate this consistently? This does not happen when all extensions are disabled.

bug builtasks fixed (release pending)

Most helpful comment

We have a fix with https://github.com/microsoft/vscode-cpptools/releases/tag/0.28.0-insiders3 . We plan to release 0.28.0 on Monday (or maybe Tuesday).

All 51 comments

Similar behavior here with ROS

The task provider for "catkin_cmake" tasks unexpectedly provided a task of type "catkin_make".
The task provider for "catkin_cmake_isolated" tasks unexpectedly provided a task of type "catkin_make_isolated".

This is there since one of the last Insider updates. My version

Version: 1.45.0-insider
Commit: ece7aaee861d7261a728d52ce436c667030ce17d
Date: 2020-05-01T09:46:11.716Z
Electron: 7.2.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 5.3.0-51-generic

reverting to 0.27.1 fix problem

Same issue for me on macOS

Version: 1.45.0-insider
Commit: fd5d9a30259bb2bebab3e62dfd8315c2e1b27744
Date: 2020-05-04T09:21:17.770Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.4.0

Same issue on macOS.

macOS Catalina 10.15.5
Code Insiders 1.45.0
C/C++ 0.28.0-Insiders

facing a similar kind of issue on 0.28 Insiders version as well as 0.27.1 version.

Edit: with all versions.

Version: 1.45.0-insider (user setup)
Commit: d4b8ec9da3bf1061a948fbb1b0d9d3db750cc79f
Date: 2020-05-05T07:13:50.890Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19041

If I run task instead of build task, the issue will not appear.
And when I click "Show All Tasks" under drop-down list of normal run task, it shows again.

Same issue for me,

Version: 1.45.0-insider (system setup)
Commit: d69a79b73808559a91206d73d7717ff5f798f23c
C/C++ 0.28.0-insiders2

but it will not appear on my vscode stable.

Version: 1.44.2 (system setup)
Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd
C/C++ 0.28.0-insiders2

@Primimy If the bug occurs on 1.45-insiders but not 1.44.2 (both with 0.28.0-insiders2) then that suggests it's a VS Code bug and not a bug with out C/C++ extension.

In this extension's call to registerTaskProvider it registers a C\C++ task provider.
https://github.com/microsoft/vscode-cpptools/blob/ef120e83137799ba0438c283388b1647ab912445/Extension/src/LanguageServer/extension.ts#L174-L180
However, then it provides tasks of type shell not of type C\C++, which is unexpected. It used to work because VS Code was just blindly accepting all tasks. With the recent changes to the task quick pick to make it faster, it can't do that. I added this error message recently so that folks would notice this problem.

The quickest and most correct way for this extension to stop having this error would be to provide tasks of type C\C++. This will fix:

  • The error in this bug
  • Problems with these tasks showing in the "recent" section of the task picker that shows when you Run Task

That said, I'll make a small change to not show the notification in this case. Then, I'll see what can be done about the task not showing in the "recent" section.

+1.
After today's VSCode update, everytime I build with Platformio I see the "_There are task errors. See the output for details_"
After clicking the "Show Output" button it reports: _The task provider for "C/C++" tasks unexpectedly provided a task of type "shell"._

Version: 1.45.0 (user setup)
Commit: d69a79b73808559a91206d73d7717ff5f798f23c
Date: 2020-05-07T16:18:48.860Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363
  • Thomas

+1, same issue for macOS 10.14.4, after update VSCode to 1.45.0.

Version: 1.45.0
Commit: d69a79b73808559a91206d73d7717ff5f798f23c
Date: 2020-05-07T15:57:33.467Z (14 hrs ago)
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.4.0

+1 Same issue on Windows 10 after update 1.45.0

Version: 1.45.0 (user setup)
Commit: d69a79b73808559a91206d73d7717ff5f798f23c
Date: 2020-05-07T16:18:48.860Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19041

The same problem for me.

version: 1.45.0 (user setup)
commit: d69a79b73808559a91206d73d7717ff5f798f23c
Date: 2020-05-07T16:18:48.860Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363

+1 Same issue on Windows 10 after the new update

Version: 1.45.0 (user setup)
Commit: d69a79b73808559a91206d73d7717ff5f798f23c
Date: 2020-05-07T16:18:48.860Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18362

Same here with the meson build extension

+1
image

I see the same error on my Mac.

Same here!

鍥剧墖
Same here.

@Primimy If the bug occurs on 1.45-insiders but not 1.44.2 (both with 0.28.0-insiders2) then that suggests it's a VS Code bug and not a bug with out C/C++ extension.

Happens on 1.45 stable.

I see the same error on MacOS too.

If you try out the Insiders build of VS Code (version 1.46), you should no longer see a notification for this message.

If you try out the Insiders build of VS Code (version 1.46), you should no longer see a notification for this message.

When I disable C/C++ extension, this bug disappear.
I hope this bug is fixed as soon as possible, it really make user confusing.

If you try out the Insiders build of VS Code (version 1.46), you should no longer see a notification for this message.

When a fixed version will be deployed?
Very annoying...

Same for me after updating to this version

Version: 1.45.0 (user setup)
Commit: d69a79b73808559a91206d73d7717ff5f798f23c
Date: 2020-05-07T16:18:48.860Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363

This error comes up every time I run a build task right now. Would appreciate a quick fix instead of waiting a month+ for 0.29.0.

1.45.0 w/ 0.28.0-insiders2

Same issue since VS Code updated (yesterday?)

My info:
Version: 1.45.0 (user setup)
Commit: d69a79b73808559a91206d73d7717ff5f798f23c
Date: 2020-05-07T16:18:48.860Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18362

Microsoft C/C++ version: 0.27.1

Same problem. Updated just now.

Version: 1.45.0 (user setup)
Commit: d69a79b73808559a91206d73d7717ff5f798f23c
Date: 2020-05-07T16:18:48.860Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363

In this extension's call to registerTaskProvider it registers a C\C++ task provider.
https://github.com/microsoft/vscode-cpptools/blob/ef120e83137799ba0438c283388b1647ab912445/Extension/src/LanguageServer/extension.ts#L174-L180

However, then it provides tasks of type shell not of type C\C++, which is unexpected. It used to work because VS Code was just blindly accepting all tasks. With the recent changes to the task quick pick to make it faster, it can't do that. I added this error message recently so that folks would notice this problem.
The quickest and most correct way for this extension to stop having this error would be to provide tasks of type C\C++. This will fix:

  • The error in this bug
  • Problems with these tasks showing in the "recent" section of the task picker that shows when you Run Task

That said, I'll make a small change to not show the notification in this case. Then, I'll see what can be done about the task not showing in the "recent" section.

Did this and it solves the problem... at least stops the message and executes the tasks... I know it's not the best, but can we comment this lines for while?

In this extension's call to registerTaskProvider it registers a C\C++ task provider.

https://github.com/microsoft/vscode-cpptools/blob/ef120e83137799ba0438c283388b1647ab912445/Extension/src/LanguageServer/extension.ts#L174-L180

However, then it provides tasks of type shell not of type C\C++, which is unexpected. It used to work because VS Code was just blindly accepting all tasks. With the recent changes to the task quick pick to make it faster, it can't do that. I added this error message recently so that folks would notice this problem.

The quickest and most correct way for this extension to stop having this error would be to provide tasks of type C\C++. This will fix:

  • The error in this bug
  • Problems with these tasks showing in the "recent" section of the task picker that shows when you Run Task

That said, I'll make a small change to not show the notification in this case. Then, I'll see what can be done about the task not showing in the "recent" section.

Did this and it solves the problem... at least stops the message and executes the tasks... I know it's not the best, but can we comment this lines for while?

What exactly did you change? Did you change the tasks.json type from shell to something else? I thought type could only be shell or process?

If you try out the Insiders build of VS Code (version 1.46), you should no longer see a notification for this message.

@alexr00 this is a very unfortunate predicament our customers have been put in. The proposed fix doesn't work (we tried it before and it broke the feature). We've been wanting to update how we do our tasks, but we can't turn on a dime and do that right before we're about to release. Is there any way we can revert your change in the next stable patch to 1.45? IMO, this should have been a console.error message since it's directed at extension developers, not the general public.

We're looking into other ways to solve this without rewriting the feature. We'll keep this thread updated.

@bobbrow @alexr00 Actually -- the fix does appear to work https://github.com/microsoft/vscode-cpptools/pull/5442 (I was hitting a failure due to another issue)...unless we find some other issue. We could ship this in our pending 0.28.0-insiders3 and/or 0.28.0 updates.

Yeah, I might have spoken too soon. There are a number of other problems with our current task provider which we will work on for 0.29.0. I think we'll try to release an insiders3 for people to try over the weekend and if it's good, then we'll get 0.28.0 out with a fix for this early next week.

We have a fix with https://github.com/microsoft/vscode-cpptools/releases/tag/0.28.0-insiders3 . We plan to release 0.28.0 on Monday (or maybe Tuesday).

Thank you for the quick fix. Installed 0.28.0-insiders3. Issue resolved.

  • Thomas

Good job,thank you.

@sean-mcmanus

Nice.

But the terminal always displays the Terminal will be reused by tasks, press any key to close it. when tasks done.

Look like this:

image

I remember it didn鈥檛 appear before. It is a bug?

@Gorgeous2017 It did appear before. It's basically similar to "press any key to continue"

+1 Same issue on Windows 10 after update 1.45.0

Version: 1.45.0 (user setup)
Commit: d69a79b73808559a91206d73d7717ff5f798f23c
Date: 2020-05-07T16:18:48.860Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19041

Actually, if you don't configure a right path for gdb, this error will occur.

What if I'm not using GDB? I use MS C++.

For those having hard time figuring this out,

  1. Open VS Code and Go to extensions, right click C/C++ then click Extension Settings
  2. Scroll down to last and "C-Cpp: Update channel" will be third last drop down list
  3. Change from default to insiders. (this will be auto saved)
  4. The downloading will start and will ask you to reload once completed AND you are done. :)
  5. Try restarting VS code if step 4 does not asks you to reload. Be patient and pray for your internet speed till you see the reload message.

+1 Same problem here.

Thanks muhammad-osaid-tekfocal, it works like a charm! :)

is it okay to revert back to default update channel after updating?

It's OK to revert back to the default Update Channel after installing the insiders release. The insider version will remain until a newer official release is available on the default Channel.

  • Thomas

@ayams02 We had a bug that prevented auto-downgrading from 0.28.0-insiders3 to 0.27.1 when the updateChannel changes to "Default" (https://github.com/microsoft/vscode-cpptools/issues/5464), but that should be fixed for future Insider releases...and we should be releasing 0.28.0 soon anyway.

Yoo-hoo! Platformio now reports it has 0.28.0 installed. @sean-mcmanus, Thank You.

  • Thomas

As of about an hour ago I have 0.28.0 installed and the issue is gone.
Thanks @ all the contributors!

Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/0.28.0 .

The default template of launch.json and task.json may be not correct as before. I generate many times to get the fine version to debug like before. I don't why, but this is the truth. Wish you could find out the real problem which causes this error. Thanks.

Was this page helpful?
0 / 5 - 0 ratings