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

ALDoc - Referenced module not loaded. Documentation incomplete if 'Temp Blob' is referenced #7551

Closed fvet closed 6 months ago

fvet commented 11 months ago

Please include the following with each issue:

1. Describe the bug

When generating documentation using aldoc.exe, method that have codeunit 'Temp Blob' as parameters are not documented.

2. To Reproduce

Following script is used to generate the documentation

cd "C:\Projects\Dynavision\Docs\"

rd "Output" /s/q
md "Output"

rem init
C:\Users\frederic.vercaemst\.vscode\extensions\ms-dynamics-smb.al-13.0.878831\bin\win32\aldoc.exe init -o "./Output" -t "C:\Projects\Dynavision\Dynavision Core\App\Dynavision_Dynavision Core_22.0.7.0.app"

pause 

rem Build
C:\Users\frederic.vercaemst\.vscode\extensions\ms-dynamics-smb.al-13.0.878831\bin\win32\aldoc.exe build -o "./Output" -s "C:\Projects\Dynavision\Dynavision Core\App\Dynavision_Dynavision Core_22.0.7.0.app"

rem DocxFx Build
docfx build "./Output/docfx.json"

rem DocxFx Server
docfx serve "./Output/_site" -p 8988

pause 

Below are 2 procedures with documentation, one using Temp Blob as parameter, the other without.

image

Code from above screenshot

/// <summary>
    /// Schedule the upload of a file to a FTP server. 
    /// The scheduled FTP request can be processed periodically by a job queue entry (codeunit "ESCA Send FTP Request Queue")
    /// </summary>
    /// <param name="FTPCode">The code of the FTP setup containing login and folder settings</param>
    /// <param name="TempBlob">A Temp Blob codeunit containing the file contents to be uploaded</param>
    /// <param name="FileName">The name of the file to be uploaded</param>
    /// <returns>The entry no. of the scheduled FTP request</returns>    
    #region ScheduleSend
    procedure ScheduleSend(FTPCode: Code[20]; var TempBlob: Codeunit "Temp Blob"; FileName: Text) EntryNo: Integer;
    var
        InStream: InStream;
    begin
        if not ModulePermission.TestModuleActive("ESCA Module"::Connect) then
            exit;

        TempBlob.CreateInStream(InStream);
        exit(ScheduleSend(FTPCode, InStream, FileName));
    end;
    #endregion ScheduleSend
/// <summary>
    /// Schedule the upload of a file to a FTP server. 
    /// The scheduled FTP request can be processed periodically by a job queue entry (codeunit "ESCA Send FTP Request Queue")
    /// </summary>
    /// <param name="FTPCode">The code of the FTP setup containing login and folder settings</param>
    /// <param name="InStream">An InStream containing the file contents to be uploaded</param>
    /// <param name="FileName">The name of the file to be uploaded</param>
    /// <returns>The entry no. of the scheduled FTP request</returns>
    #region ScheduleSend
    procedure ScheduleSend(FTPCode: Code[20]; var InStream: InStream; FileName: Text) EntryNo: Integer;
    var
        FTPRequest: Record "ESCA FTP Request";
        FTPRequestFile: Record "ESCA FTP Request File";
        FTPSetup: Record "ESCA FTP Setup";
        OnlyForDirectionExportErr: Label 'Method ScheduleSend is only supported for %1s (%2: %3) where the direction is %4.';
        OutStream: OutStream;
    begin
        if not ModulePermission.TestModuleActive("ESCA Module"::Connect) then exit;

        FTPSetup.Get(FTPCode);
        if FTPSetup.GetDirection() <> "ESCA Direction"::Export then
            Error(OnlyForDirectionExportErr, FTPSetup.TableCaption(), FTPSetup.FieldCaption(Code), FTPSetup.Code, "ESCA Direction"::Export);

        FTPRequest.Init();
        FTPRequest.Validate("FTP Code", FTPSetup.Code);
        FTPRequest.Validate(Status, "ESCA Request Status"::"In Queue");
        FTPRequest.Insert(true);

        FTPRequestFile.Init();
        FTPRequestFile.Validate("Request Entry No.", FTPRequest."Entry No.");
        FTPRequestFile.Insert(true);

        FTPRequestFile.Validate("File Name", FileName);
        FTPRequestFile.Blob.CreateOutStream(OutStream);
        CopyStream(OutStream, InStream);
        FTPRequestFile.Modify(true);

        exit(FTPRequest."Entry No.");
    end;
    #endregion ScheduleSend

Below is a screenshot of the resulting documentation:

image

In the output of the aldoc command, we get a warning on

warning: Referenced module not loaded. Name:'Application', Version:22.3.0.0, AppId:00000000-0000-0000-0000-000000000000

C:\Projects\Dynavision\Docs>C:\Users\frederic.vercaemst\.vscode\extensions\ms-dynamics-smb.al-13.0.878831\bin\win32\aldoc.exe build -o "./Output" -s "C:\Projects\Dynavision\Dynavision Core\App\Dynavision_Dynavision Core_22.0.7.0.app"
warning: Referenced module not loaded. Name:'Application', Version:22.3.0.0, AppId:00000000-0000-0000-0000-000000000000
Writing Content
Writing Obsoletion Lists
Writing Table of Content

Build succeeded with warning.

    1 warning(s)
    0 error(s)

C:\Projects\Dynavision\Docs>rem DocxFx Build

C:\Projects\Dynavision\Docs>docfx build "./Output/docfx.json"
Searching custom plugins in directory C:\Users\frederic.vercaemst\.dotnet\tools\.store\docfx\2.70.0\docfx\2.70.0\tools\net7.0\any\...
6 plug-in(s) loaded.
No files are found with glob pattern override_files/**.md, excluding <none>, under directory "C:\Projects\Dynavision\Docs\Output"
2 schema driven document processor plug-in(s) loaded.
Building 6 file(s) in BusinessCentralObsoletionList(BuildSchemaBasedDocument=>ApplyOverwriteFragments=>ApplyOverwriteDocument=>ApplyTags)...
Building 2 file(s) in TocDocumentProcessor(BuildTocDocument)...
Building 1 file(s) in ConceptualDocumentProcessor(BuildConceptualDocument=>CountWord=>ValidateConceptualDocumentMetadata)...
Building 422 file(s) in BusinessCentralApplicationObject(BuildSchemaBasedDocument=>ApplyOverwriteFragments=>ApplyOverwriteDocument=>ApplyTags)...
Applying templates to 430 model(s)...
XRef map exported.
Manifest file saved to manifest.json.
Completed building documents in 2440.2891 milliseconds.

Build succeeded.

    0 warning(s)
    0 error(s)

When I remove the 'Temp Blob' parameter as function argument, document is correct.

image

3. Expected behavior

Please provide instructions on how to include the 'Temp Blob' references in the documentation.

4. Actual behavior

5. Versions:

Name: AL Language extension for Microsoft Dynamics 365 Business Central
Id: ms-dynamics-smb.al
Description: Development tools for Dynamics 365 Business Central
Version: 12.1.883011
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dynamics-smb.al
navdotnetreqs commented 8 months ago

By adding the base app-files in the parameter list (-t my.app,system.app,baseapp.app,app.app), I got a whole bunch of new warnings and errors, but the documentation looks better and I seem to have gotten the missing comments.

https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/help/help-aldoc-generate-help

SBalslev commented 6 months ago

@navdotnetreqs is correct - including references will include them.