Navision can't count ...

rdebathrdebath Member Posts: 383
I thought you might like this little Navision bug ... tested 2.6, 4 and 5sp1

Variables I and J are integers, init to zero.

FOR J := 1 TO 31 DO I := I * 2 + 1; I := (-1 -I) * -1;

Just make sure you've saved everything :twisted:

Comments

  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    I think it's nothing about count but about overflow. For normal an error message like
    Overflow under type conversion of Decimal to Integer.

    Value: -2.147.483.648
    should appear. But in this case the client crashes.
    Try this
    i := (-1 -2147483647) * -1;
    
    and you will get the same bug.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • BgestelBgestel Member Posts: 136
    other magical tricks include the folowing

    make a table

    in the ondelete trigger put a local var of the same type as the table

    and put the following code in the ondelete trigger.

    localvar.findfirst;
    localvar.delete(true);

    now insert some records and F4 the first record :bug: :bug: :bug:
    **********************
    ** SI ** Bert Van Gestel **
    **********************
  • kinekine Member Posts: 12,562
    There is other (worked in 2.6, I do not know if still working...)
    RecVar.COPYFILTERS(RecVar);
    

    On Native Server it crashed whole DB server...[/code]
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rdebathrdebath Member Posts: 383
    Bgestel wrote:
    localvar.findfirst;
    localvar.delete(true);

    Navision has never been good with stack overflows, I think it got a bit better with about 3.6 when it stopped dieing with direct recursion but there are still lots of indirect methods.

    i := (-1 -2147483647) * -1;

    OTOH this doesn't generate any error, it should be the same.
    i := -(-1 -2147483647);
    
    Of course it's not the right result... :bug:

    Another nice one is this:
    i := (-1 -2147483647);
    i := i / 1;
    
    The first line is OK but the second (!) generates an error.
  • ara3nara3n Member Posts: 9,256
    edit
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.