Object reference not set to an instance of an object.

Abierto
#8,369 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
vscode
Área
compilers

Línea de trabajo

Start by reproducing the crash with the table example in the issue, where the Option field sets ValuesAllowed without OptionMembers, then the page example with RunPageLink using a const date. The call stacks are only in the screenshots, so capture your own from the AL extension output. Done means the compiler reports a proper diagnostic telling the author that OptionMembers must be set, instead of throwing System.NullReferenceException, and the same holds for the RunPageLink case.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Please include the following with each issue:

1. Describe the bug
Creating an option type table field with ValuesAllowed set without OptionMembers set throws with System.NullReferenceException.

2. To Reproduce
Open VS Code with AL Extension version 18.1.2842859 or 30.0.2863738. Create a table with an option field which has ValuesAllowed set but OptionMembers not set. Expected result is a message informing the author that OptionMember must be set. If both are set there is no issue. If OptionMember is not set but ValuesAllowed is also not set there will likewise be no issue (correct error message).

A similar issue can be observed when creating a page with the following property set on an action
RunPageLink = "Date Filter" = const(-20240101D);.

Same error message but different call stack in this scenario.

  1. Go to '...'
Table example:
table 50100 "PTE Some Table"
{
    fields
    {
        field(1; "My Field"; Option)
        {
            DataClassification = ToBeClassified;
            //OptionMembers = "Some Value";
            ValuesAllowed = "Some Value";
        }
    }
}

Page example:
page 50100 "PTE Some Page"
{
    SourceTable = Customer;
    actions
    {
        area(Processing)
        {
            action(A)
            {
                RunObject = page "Customer Card";
                RunPageLink = "Date Filter" = const(-20240101D);
            }
        }
    }
}


Note: The same can be observed even if the field we are using in RunPageLink is not a date type as long as we are using this constant value (-0D also throws, other malformed versions of dates I tried did not.)

3. Expected behavior
To get the errors which I get in with any other values (explaining what the issue is in the code rather than the compiler crashing.)

4. Actual behavior

Image Image Image

5. Versions:

  • AL Language:
  • Visual Studio Code: 18.1.2842859 or 30.0.2863738
  • Business Central: Not needed for this example.
  • List of Visual Studio Code extensions that you have installed:
  • .NET Install Tool & AL Language extension for Microsoft Dynamics 365 Business Central
  • Operating System:
    • [ W11 Home 25H2 26200 & W11 Enterprise 25H2 26200 (2 laptops) ] Windows
    • [ X] Linux
    • [ X] MacOS
Final Checklist

Please remember to do the following:

  • [ Checked and didn't see these specific errors.] Search the issue repository to ensure you are reporting a new issue

  • [ .Net Install Tool is a dependency of AL .. all others are uninstalled] Reproduce the issue after disabling all extensions except the AL Language extension

  • [ ✔️] Simplify your code around the issue to better isolate the problem

Lenguaje dominante
PowerShell
Estrellas
891
Forks
287
Merge medio
4 h 7 min
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/AL

Todos los issues de microsoft/AL

Issues similares

Más issues de Compilers

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.