Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: VsCodeIntegration create AppId Dependencie with Brackets #3114

Closed
1 task done
BB97GER opened this issue Feb 27, 2025 · 2 comments · Fixed by #3137
Closed
1 task done

[Bug]: VsCodeIntegration create AppId Dependencie with Brackets #3114

BB97GER opened this issue Feb 27, 2025 · 2 comments · Fixed by #3137
Labels
Approved The issue is approved Integration GitHub request for Integration area

Comments

@BB97GER
Copy link
Contributor

BB97GER commented Feb 27, 2025

Describe the issue

  1. Open the "Extension Management" (Page 2500)
  2. Use Page Action "Show dependencies"
  3. Output in the Message:
    [
    {
    "id": "{2461702A-1604-40AE-8F01-455922AECB26}",
    "name": "PartnerX WMS",
    "publisher": "PartnerX",
    "version": "1.0.0.0"
    }
    ]
    Problem:
    In the app.json the id does not match the pattern.

Image

Expected behavior

The Output in the Message should be without the brackets:
{
"id": "2461702A-1604-40AE-8F01-455922AECB26",
"name": "PartnerX WMS",
"publisher": "PartnerX",
"version": "1.0.0.0"
}

I think that since we are in the context of the VSCode integration, the brackets should be removed during creation. It is also done in the implementation in the function FormatDependencyAsParameter.

Example:

 [Scope('OnPrem')]
    local procedure FormatDependencyAsParameter(var NavAppInstalledApp: Record "NAV App Installed App"): Text
    var
        AppVersion: Text;
        DependencyFormatLbl: Label '%1,%2,%3,%4;', Comment = '%1 = Id, %2 = Name, %3 = Publisher, %4 = Version', Locked = true;
    begin
        // Skip System and Base app
        case NavAppInstalledApp."App ID" of
            SystemApplicationIdTxt, BaseApplicationIdTxt, ApplicationIdTxt:
                exit('')
            else
                AppVersion := FormatDependencyVersion(NavAppInstalledApp."Version Major", NavAppInstalledApp."Version Minor", NavAppInstalledApp."Version Build", NavAppInstalledApp."Version Revision");
                exit(StrSubstNo(DependencyFormatLbl, Format(NavAppInstalledApp."App ID", 0, 4), NavAppInstalledApp.Name, NavAppInstalledApp.Publisher, AppVersion)); // Format of GUID
        end

Solution:

  [Scope('OnPrem')]
    local procedure FormatDependencyAsSerializedJsonObject(var PublishedApplication: Record "Published Application") Value: Text
    var
        AppId: Text;
        AppVersion: Text;
        Dependency: JsonObject;
    begin
        AppId := FormatDependencyGuidWithoutBrackets(PublishedApplication.ID); // New
        Dependency.Add('id', AppId);
        Dependency.Add('name', PublishedApplication.Name);
        Dependency.Add('publisher', PublishedApplication.Publisher);
        AppVersion := FormatDependencyVersion(PublishedApplication."Version Major", PublishedApplication."Version Minor", PublishedApplication."Version Build", PublishedApplication."Version Revision");
        Dependency.Add('version', AppVersion);

        Dependency.WriteTo(Value);
    end;
[Scope('OnPrem')]
local procedure FormatDependencyGuidWithoutBrackets(Id: Guid): Text
    begin
        exit(Format(Id).TrimStart('{').TrimEnd('}'));
    end;

Steps to reproduce

Show above.

Additional context

codeunit 8333 "VS Code Integration Impl."

I will provide a fix for a bug

  • I will provide a fix for a bug
@zeande
Copy link
Contributor

zeande commented Feb 27, 2025

@BB97GER - In the proposed solution, I would suggest instead using Format with format number = 4 to avoid the manual trimming. Also converting to lower case could be an additional improvement, since that is more VS Code / app.json standard.

@BB97GER
Copy link
Contributor Author

BB97GER commented Feb 28, 2025

@zeande - good hint

[Scope('OnPrem')]
local procedure FormatDependencyId(AppId: Guid): Text
begin
  exit(LowerCase(Format(AppId, 0, 4));
 end;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved The issue is approved Integration GitHub request for Integration area
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants