D365 F&O etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
D365 F&O etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

27 Kasım 2021 Cumartesi

Dynamics 365 F&O - If debugger begin jump meanless this would be about an endless recursive call

 I wrote an endless recursive call with AX 2012 accidentally. When I run my code I suspected an endless loop and tried to debug. Debugger was jumping from there by a confusing way over there in code meanless. I did a bit of google and found this would be about an endless recursive call.

When I lived same situation with 365 F&O two days ago it was so surprising for me. With all new compiled base in Visual Studio debugger I wouldn't expect this strange behaviour again. This time it was a bit different but same behaviour again (In 2009 it was going irrelevant code lines in every hit, this time in one point it was going irrelevant code again but after that begun an endless loop without a loop). This time I remembered what I lived with in 2009, so I fixed it fast.

At the end I mean if your debugger goes irrelevant code, -doesn't matter if 2009, 2012 or 365 F&O- you would be written an endless recursive call (Or your colleague would do a test in your DEV machine).


9 Mart 2021 Salı

D365 F&O - Add right-click popup menu to form control

 In 2015 I shared a sample  about this issue which run both of AX 2009 and AX 2012. Seem Microsoft decided to change this too with 365, so that code doesn't run on 365 anymore. Microsoft shared a white page as before-after, I learned from that page. It was run with one method, since 365 two methods.

We declare these constants at class declaration. Of course these are not mandatory but good for writing human readable code:

public const int listCredit = 1;

public const int listJournal = 2;

We put this metod into control which we run popup. This method run popup menu. This sample has two popup bars:

        public str getContextMenuOptions()
        {
            str ret;
            ContextMenu menu = new ContextMenu();
            List menuOptions = new List(Types::Class);
            ContextMenuOption option;
            
            option = ContextMenuOption::Create("Credit number", listCredit);
            menuOptions.addEnd(option);

            option = ContextMenuOption::Create("Journal number", listJournal);
            menuOptions.addEnd(option);

            menu.ContextMenuOptions(menuOptions);
            return menu.Serialize();
        }

  This method triggers when select a bar at popup:

 public void selectedMenuOption(int selectedOption)
        {
            switch (selectedOption)
            {
                case -1:
                    break;
                case listCredit:

                    info("Bar 1 selected!..");
                    break;
                case listJournal:
                    info("Bar 2 selected!..");
                    break;
            }
        }

In my tests popup menu sometines doesn't showed up. I never see before at neither 2012 nor 2009. I couldn't find reason. When debugged see getContextMenuOptions doesn't triggered when bars doesn't showed up.