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

InlayHint fails #7974

Open
1 task done
MaxFalcone opened this issue Feb 18, 2025 · 0 comments
Open
1 task done

InlayHint fails #7974

MaxFalcone opened this issue Feb 18, 2025 · 0 comments

Comments

@MaxFalcone
Copy link

MaxFalcone commented Feb 18, 2025

1. Describe the bug
InlayHins doesn't show up.

Object reference not set to an instance of an object error is posted in the output of AL.

2. To Reproduce
Enable InlayHints for AL in vscode

"al.inlayhints.parameterNames.enabled": true,
"al.inlayhints.functionReturnTypes.enabled": true,
"editor.inlayHints.enabled": "offUnlessPressed",

Create a codeunit file with following content

codeunit 50100 "Inlay"
{
    local procedure PurchShipmentToJson(var WarehouseShipmentHeader: Record "Warehouse Shipment Header"; var WarehouseShipmentLine: Record "Warehouse Shipment Line") RequestJson: JsonObject
    var
        PurchaseHeader: Record "Purchase Header";
        Vendor: Record Vendor;
        FormatAddress: Codeunit "Format Address";
        AddressArray: array[8] of Text[100];
    begin
        PurchaseHeader.Get(WarehouseShipmentLine."Source Subtype", WarehouseShipmentLine."Source No.");
        FormatAddress.PurchHeaderBuyFrom(AddressArray, PurchaseHeader);
        Vendor.Get(PurchaseHeader."Buy-from Vendor No.");
        Vendor.TestField("VAT Registration No.");
    end;
}

Press and hold Ctrl+Alt to trigger inlay hints.

3. Expected behavior
Inlay hints for parameters are shown

4. Actual behavior
Inlay hints are not shown and outup contains the following error message

[Error - 11:45:14 AM] Please report this issue to https://github.com/microsoft/al/issues including information on how to reproduce it, if possible.
Processing of message 'textDocument/inlayHint' failed with error: 'Object reference not set to an instance of an object.'
Details:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Dynamics.Nav.CodeAnalysis.SymbolDisplayVisitor.GetRecordStructure(Symbol symbol) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\SymbolDisplay\SymbolDisplayVisitor.cs:line 1493
   at Microsoft.Dynamics.Nav.CodeAnalysis.SymbolDisplayVisitor.VisitParameter(ParameterSymbol symbol) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\SymbolDisplay\SymbolDisplayVisitor.cs:line 273
   at Microsoft.Dynamics.Nav.CodeAnalysis.SymbolDisplay.ToDisplayParts(ISymbol symbol, SemanticModel semanticModelOpt, Int32 positionOpt, SymbolDisplayFormat format, Boolean minimal) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\SymbolDisplay\SymbolDisplay.cs:line 103
   at Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.Symbol.ToDisplayString(SymbolDisplayFormat format, SemanticModel semanticModel) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\Symbols\Symbol.cs:line 529
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.InlayHintRequestHandler.GetInlayHints(Document document, Nullable`1 range, CancellationToken cancellationToken)
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.InlayHintRequestHandler.HandleAsync(InlayHintRequest request, Int32 requestId, CancellationToken cancellationToken) in X:\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\InlayHintRequestHandler.cs:line 46
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.MessageProtocol.RequestHandlerBase`1.HandleAsync(JToken requestContents, Int32 requestId, CancellationToken cancellationToken) in X:\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\MessageProtocol\RequestHandlerBase.cs:line 84
   at Microsoft.Dynamics.Nav.EditorServices.Protocol.RequestRegistry.Process(Message message) in X:\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Endpoints\RequestRegistry.cs:line 84

5. Versions:

  • AL Language: 14.2.1249978
  • Visual Studio Code: 1.97.2
  • Business Central: 25.2
  • List of Visual Studio Code extensions that you have installed: AL only
  • Operating System:
    • Windows: Windows 11 (23H2)
      Internal work item: AB#566075
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants