Skip to content

"launch" configuration fails on multi-root workspace, when defined in .code-workspace file. #58818

Closed

Description

There seems to be a problem when defining the launch configurations inside the .code-worksapce file, when using a multi-root workspace. The exact same configuration in the launch.json file works correctly, but I would like to move it to the .code-workspace file to get rid of the launch.json file, and have everything on a single file.

  • VSCode Version: 1.27.2
  • OS Version: Ubuntu 16.04.5 LTS

Steps to Reproduce:

  1. Create a multi-root workspace.
  2. Create a launch configuration in the .code-workspace file under "launch".
  3. Set the values of "cwd" or "program" of a launch configuration to be relative to one of the workspace folders: for instance "cwd": "${workspaceFolder:src1}/folder1/folder2".
  4. When trying to launch this configuration, an error appears on the bottom right, that says: "Cannot read property 'name' of undefined". (It would also be nice if this error could give me more info, such as line number)
    5: If I have the exact same configuration with the exact same "cwd" and "program" values in my launch.json file, this error doesn't happen: the configuration is launched correctly.

Does this issue occur when all extensions are disabled?: Doesn't work, as it needs cppdbg

Activity

  1. added
    debug
    on Sep 17, 2018
  2. dsanz006 commented on Sep 17, 2018

    @dsanz006
    Author

    I have tried defining my workspace folders both as absolute path or relative to the .code-workspace file, and the error happens in both cases.

  3. added
    info-needed
    on Sep 17, 2018
  4. isidorn commented on Sep 17, 2018

    @isidorn

    Can you please paster the minimal launch.json for which you can reproduce this.
    And I guess moving that launch.json to the code-workspace would reproduce the problem?

  5. dsanz006 commented on Sep 18, 2018

    @dsanz006
    Author

    Ok so to make things easy I just created a github repository where I show how this fails. It is @ https://github.com/dsanz006/launch_test.

    It is a simple C Hello world project with one include file. In tasks.json, I create an executable with GCC. And in launch.json I have a configuration to run the executable, which works fine. This configuration also references the gcc command in tasks.json as a prelaunch task. All of this is shown in the "master" branch.

    Now, I created another branch, named "force_launch_fail", where I am commenting out the content of launch.json, and moving it to my .code-workspace file, under the key "launch". If you try to launch this configuration with F5, you will get the error I mentioned: "Cannot read property 'name' of undefined".

    It would also be very nice if I could get at least a line number for this error.

  6. isidorn commented on Sep 26, 2018

    @isidorn

    Daniel Sanz Ausin (@dsanz006) the issue here is that you are referencing a task from a folder from a workspace launch. We currently do not support that, and in order to have something like that #36966 would be needed
    To avoid the confusion I have improved the error message

    screen shot 2018-09-26 at 13 58 36

  7. added
    bug
    and removed
    info-needed
    on Sep 26, 2018
  8. dsanz006 commented on Sep 26, 2018

    @dsanz006
    Author

    I understand, thank you Isidor Nikolic (@isidorn).

  9. locked and limited conversation to collaborators on Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugdebugverified

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions