AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 11.05.2018, 05:26   #1  
Blog bot is offline
Blog bot
Участник
 
20,451 / 711 (64) +++++++
Регистрация: 28.10.2006
stoneridgesoftware: Class Variables, AOS Crashes, and Compile Forward in Dynamics AX 2012
Источник: https://stoneridgesoftware.com/class...amics-ax-2012/
==============

Recently I made the transition from Dynamics AX 2009 to Dynamics AX 2012 and continue to learn all the differences between the two (I know, it’s 2018!). That being said, I was tasked with making a minor change to the dialog for project estimates which originates in the ProjControlPeriod class.

Simple. I add my new class variable, create my “parm” method, update the main method to set my new variable, and add my extra five lines in the class to perform what I need for the requirements. Done.

I open up the dialog, fill it in, click “OK” and instantly the AOS has crashed.

I restart the AOS – no need to open DEV because this is a very simple change, just going to test it real quick. Open the dialog, fill it in, click “OK”. Bang! The AOS has crashed again.

Restarting everything again.

So now it’s time to be a bit more cautious. I get everything started up, put in a breakpoint at the top of the main method of the class and off we go. Debugger starts, and I start stepping over each line. There’s where I get the value for my new variable, here’s my new parm method. I know nothing is wrong with that, so I step over and there goes the AOS again. Now I’m annoyed. That couldn’t have been right.

Restart everything again.

I look at the main method. I look at my parm method. Everything is good. Something weird’s going on, but what? I begin stepping over each line again. I get to the call to my new parm method, I step in, I get to the line where the value gets assigned and…

Restart everything again!

So what’s going on! I trace back to before I assign my new variable and start examining things. HUH? Where’s my variable? I examine my class and my variable isn’t there. I quit the debugger, look at my code, looks good, trace back to the assignment, nope no variable.

I try everything I can think of, recompile, incremental CIL, full CIL and after a few more AOS crashes I reach out to a co-worker for anything he can think of…

Compile forward

The compile forward feature in AX 2012 is something that I never needed in AX 2009. There might have been a reason, had I worked in that environment for another eight years, but it wasn’t something I’d ever needed. During development, you make your changes and save them which will perform a simple compile of the class. Compile forward, which is available by right-clicking your object and under the Add-Ins, will compile your object and anything else that references that object.



So, in my example, ProjControlPeriod’s construct method will actually choose one of eight other classes to instantiate that extend the ProjControlPeriod class. Even though all my code was within the ProjControlPeriod class, once one of the other classes (in my case ProjControlPeriodCreate) was instantiated, it didn’t know about my new class variable and the moment I tried to assign it is when I would lose the AOS.

A long story for what now seems such a simple thing. Hopefully, the hours of my frustration can benefit others out there.



Источник: https://stoneridgesoftware.com/class...amics-ax-2012/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Axilicious:What about this new eXceLleNT Dynamics AX compiler? Blog bot DAX Blogs 0 08.12.2015 22:12
palleagermark: Endless loop: AX tries to compile form and crashes Blog bot DAX Blogs 0 12.03.2015 12:11
emeadaxsupport: A complete list of FY14 Microsoft Dynamics AX Monthly webinars with links to recordings. Blog bot DAX Blogs 0 31.07.2014 16:11
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 10 Blog bot Dynamics CRM: Blogs 0 17.08.2012 03:27
Platform updates overview - 3.70.B - NAV2009 R2 Blog bot Dynamics CRM: Blogs 0 07.02.2011 22:06
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 20:00.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.