microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
733 stars 243 forks source link

Error on "Download Symbols" or "Publish" with multiple configurations in launch.json #4525

Open rvanbekkum opened 5 years ago

rvanbekkum commented 5 years ago

Describe the bug When I have a launch.json file with two configurations and I try to use the "AL: Download Symbols" command, I get an error saying "Could not download symbols. Please see the Visual Studio Code output log for more details.". The output log then only reports: "Error: No server has been chosen". If I try this a second time, then I will be prompted to select the instance I would like to use, and everything works as expected.

To Reproduce First, have a launch.json with multiple configurations, e.g. (N.B. I have removed our server and instance names from this example):

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "al",
            "request": "launch",
            "name": "Config1",
            "server": "<myserver>",
            "serverInstance": "<config1_instance>",
            "authentication": "Windows",
            "startupObjectId": 30,
            "startupObjectType": "Page",
            "breakOnError": true,
            "breakOnRecordWrite": false,
            "schemaUpdateMode": "Synchronize"
        },
        {
            "type": "al",
            "request": "launch",
            "name": "Config2",
            "server": "<myserver>",
            "serverInstance": "<config2_instance>",
            "authentication": "Windows",
            "startupObjectId": 30,
            "startupObjectType": "Page",
            "breakOnError": true,
            "breakOnRecordWrite": false,
            "schemaUpdateMode": "Synchronize"
        }
    ]
}

(If you want to, you can restart VSCode after this change, but it does not make a difference.) Then press Ctrl + Shift + P and choose "AL: Download Symbols" from the command palette. You will shortly see the prompt pop up, but it closes immediately, so you won't be able to make a selection. After this you will get the error described above. If you try this a second time, it works as expected.

This happens at least every time you reopen VSCode and try to run this command.

The same happens when you try to Publish, for which you would expect to be prompted to select a configuration, but instead you'll get a similar error.

All my colleagues are experiencing the same bug.

Expected behavior I would expect it to work the first time that I try to run the command, prompting me for the instance that I would like to use, like it does when I try to run this command a second time.

Versions:

JohanStenberg100 commented 5 years ago

Hi @rvanbekkum, I can also reproduce it on our master branch version. Thanks for reporting this bug.

tinfister commented 5 years ago

If you look closely you could see that "choose server window" opens for couple milliseconds and closes. You have no chance to select server in time and hence the error. It is really annoying

PatrickSchiefer commented 5 years ago

Are there any news or a workaround for this Topic? It's really hard to test and debug on different Environments.

tinfister commented 5 years ago

Comment the configuration/s in launch and leave just one

PeterConijn commented 2 years ago

I recently had the same issue when trying to download symbols from our cloud sandbox. The strange thing is, it worked for one project, but not for the other while they had the same launch.json.

{
    "version": "0.2.0",
    "configurations": [                
        {
            "name": "Microsoft cloud sandbox",
            "request": "launch",
            "type": "al",
            "environmentType": "Sandbox",
            "environmentName": "Dyselsb",
            "tenant": "ea2b2504-af48-4904-aa12-8c612eedd299", //For this post, this is a fictional tenant ID
            "startupObjectId": 22,
            "startupObjectType": "Page",
            "breakOnError": true,
            "launchBrowser": true,
            "enableLongRunningSqlStatements": true,
            "enableSqlInformationDebugger": true
        }
    ]
}

Version: NL Business Central 19.0 (Platform 19.0.29884.32731 + Application 19.0.29894.30403)

Result:

afbeelding

jwikman commented 2 years ago

@PeterConijn I just had the very same issue, but it was caused by a comment in the app.json file. The compiler seems to handle // comments in app.json, but the AL Language Extension freaks out with really strange behaviors.

PeterConijn commented 2 years ago

@jwikman Thanks for the tip. However, I checked our app.json and it is woefully devoid of comments. The comment about the dummy guid in the launch.json in my original post is not normally there, but only added for clarification.

KuljitSinghParmar commented 2 years ago

I have the same issue . there is no comment in app.json files.

kontax85 commented 2 years ago

I just had the same issue, for anyone facing it: in my case the cause was having some not valid character in the app.json (no error compiling) because of copy pasting from the BC docs regarding app vaults.

PeterConijn commented 2 years ago

I just had the same issue, for anyone facing it: in my case the cause was having some not valid character in the app.json (no error compiling) because of copy pasting from the BC docs regarding app vaults.

Thanks for the input. I thought this might be the case, so I created a new project with AL:Go! that auto-generates the configuration, but it keeps showing the same behavior, which leads me to believe it is something in VS Code or one of the AL extensions.

rellorin-accessit commented 2 years ago

I was tracking this for a bit and i saw no resolution had been found. My issue was that there was no comma between my dependencies in my app.json. The compiler doesn't highlight these errors.

Ashneil commented 2 years ago

I faced the same problem. Identified the problem. It was to do with my App.Json File. A comma was missing from IDRanges, as i had defined several ID Ranges. Correcting this i was able to successfully Download Symbols and connect to the BC Environment.

tmajvdlaan commented 1 year ago

I had a similar problem, and it turned out that I had several dependencies in my app.json, of which the last one had a trailing comma; removing this comma solved my problem.

LLeeman commented 10 months ago

I also had this problem and for me it was the line: "allowDownloadingSource": true. in my App.json file. I had to change it from false to true.