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
737 stars 243 forks source link

Cannot suppress diagnostic AL1080 via ruleset.json file #7691

Open rvanbekkum opened 6 months ago

rvanbekkum commented 6 months ago

1. Describe the bug It is not possible anymore to disable diagnostic AL1080 via a ruleset.json file. Even though you change the severity of the diagnostic, it will eventually still show up with Info severity.

2. To Reproduce

  1. Have an AL project with the following app.json:

    {
      "id": "c418fd2f-ccad-4d4a-b51c-a31f7112ea6d",
      "name": "Some Name",
      "publisher": "Some Publisher",
      "brief": "This app is amazing and does everything your heart desires.",
      "description": "This app is amazing and does everything your heart desires.",
      "version": "1.0.0.0",
      "privacyStatement": "https://www.microsoft.com",
      "EULA": "https://www.microsoft.com",
      "help": "https://www.microsoft.com",
      "contextSensitiveHelpUrl": "https://www.microsoft.com/",
      "url": "https://www.microsoft.com",
      "logo": "Resources/Logo.png",
      "dependencies": [
      ],
      "screenshots": [],
      "application": "23.0.0.0",
      "platform": "23.0.0.0",
      "idRanges": [
        {
          "from": 70000000,
          "to": 70000999
        },
      ],
      "features": [
        "TranslationFile"
      ],
      "resourceExposurePolicy": {
        "allowDebugging": true,
        "allowDownloadingSource": false,
        "includeSourceInSymbolFile": false,
        "applyToDevExtension": true
      },
      "runtime": "12.0",
      "target": "Cloud"
    }
  2. Have a ruleset.json which disables the AL1080 diagnostic for this AL project and configure your project's settings.json to use that ruleset.json file.
{
    "name": "My Ruleset",
    "description": "Rules for my BC extensions.",
    "rules": [
        {
            "id": "AL1080",
            "action": "None",
            "justification": "Source will still be visible for this extension via debugging because 'allowDebugging' has been set to true."
        }
    ]
}
  1. Reload your project. VSCode will still show a diagnostic.

(You can also set the action to something different (e.g., Warning): Then initially it will show the diagnostic with the correct severity, but afterwards, it will switch back to showing the diagnostic with Info severity.)

3. Expected behavior The diagnostic should be suppressed and should not show up as an Info diagnostic, like it was before.

4. Actual behavior The diagnostic is not suppressed/severity is not changed and stubbornly shows up as an Info diagnostic.

5. Versions:

Final Checklist

Please remember to do the following:

See also: https://www.yammer.com/dynamicsnavdev/threads/2716326117179392

rvanbekkum commented 6 months ago

It looks like there has been a recent change somewhere and now compiler diagnostics that used to be only visible in the OUTPUT tab of VS Code are now also visible in the Problems tab. This would not be a problem for this diagnostic if we had a proper way to suppress it.

dannoe commented 6 months ago

Just out of curiosity: When is the warning AL1080 generated?

Can you try to put "suppressWarnings": ["AL1080"] in your app.json?

rvanbekkum commented 6 months ago

Just out of curiosity: When is the warning AL1080 generated?

This diagnostic is raised when you use the resourceExposurePolicies property in your app.json file and have allowDebugging set to true while having includeSourceInSymbolFile set to false. This can be reproduced with the example app.json from the original issue description.

See also: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/diagnostics/diagnostic-al1080

Can you try to put "suppressWarnings": ["AL1080"] in your app.json?

I can, but that is not what the issue is about and I would rather not apply such a change to tens or hundred of repositories/apps to avoid it from showing up. With this issue I would like to point out a regression in how/where this diagnostic is raised. By further investigation I found that with previous versions of ALC this diagnostic would only be shown in the OUTPUT tab in Visual Studio Code, but with the latest versions of ALC this behaviour has changed and diagnostics that would previously only be shown in the OUTPUT tab now also seem to be shown as diagnostics on the app.json file. (Sidenote: This also happens for diagnostics that are unrelated to the app.json file though.)

dannoe commented 6 months ago

Just out of curiosity: When is the warning AL1080 generated?

This diagnostic is raised when you use the resourceExposurePolicies property in your app.json file and have allowDebugging set to true while having includeSourceInSymbolFile set to false. This can be reproduced with the example app.json from the original issue description.

See also: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/diagnostics/diagnostic-al1080

And "applyToDevExtension" must be set to true. I've never seen this warning and we use the same settings (except applyToDevExtension).

Can you try to put "suppressWarnings": ["AL1080"] in your app.json?

I can, but that is not what the issue is about and I would rather not apply such a change to tens or hundred of repositories/apps [...]

I was just trying to give the Microsoft guys more information on what might be causing this. I just tested it and suppressWarnings doesn't help either.

BazookaMusic commented 6 months ago

There was a bug where these diagnostics were not being emitted to the problems window and it was fixed. Unfortunately, what seems to not have been fixed is that they are not suppressed properly. Thanks for reporting this

rvanbekkum commented 6 months ago

Thanks for the feedback. 😊