Class Variables, AOS Crashes, and Compile Forward in Dynamics AX 2012

by | May 10, 2018 | Development, Dynamics AX

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.

Compile forward

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.

Related Posts

  • The Safari browser is now supported natively on Dynamics AX 2012 R2 as well as being supported on Dynamics AX RTM with a hotfix.  Taken from the updated System Requirements…

  • I put together some certification information on the requirements for Microsoft Dynamics AX 2012 and a proposed training roadmap to get to each of the core certifications.  Rather than have this…

  • With the announcement of the release of Microsoft Dynamics AX 2012 R2, Microsoft released an updated system requirements document for AX 2012: http://www.microsoft.com/en-us/download/details.aspx?id=11094.  Windows 2012 Server is now supported, but…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events

september

02sep10:00 am10:30 amThe Modern Manufacturer - Cycle Count Management

02sep12:00 pm12:30 pmBest Practices for Work Order Planning and Routing for Field Service Companies

09sep10:00 am11:00 amWhat is Levridge? An Overview of the Ultimate Ag Solution

09sep12:00 pm12:30 pmOverview of Microsoft Promotion for NAV and GP Clients

10sep11:00 am12:00 pmConfab with Stoneridge - Livestream - Field Service Comparisons

16sep10:00 am10:30 amThe Modern Manufacturer - Product Lifecycle Management

16sep12:00 pm12:30 pmHow to Upgrade to Dynamics 365 Finance and Operations: Examining Custom Code and ISV Implications

16sep2:00 pm2:30 pmScheduling and Dispatching for the Modern Field Service Company

23sep12:00 pm1:00 pmDynamics 365 Business Central Wave 2 Release Preview - An Overview of the Most Exciting New Features Coming in October

24sep11:00 am12:00 pmConfab with Stoneridge - Livestream - The Modern Workplace: Teams, Sharepoint, Outlook, Office, and AI Integration

30sep10:00 am10:30 amThe Modern Manufacturer - Return Management

30sep12:00 pm12:30 pmEmpowering Your Field Service Technicians with a Mobile Solution

october

07oct12:00 pm1:00 pmThe Three Paths to Business Central from Dynamics GP

08oct11:00 am12:00 pmConfab with Stoneridge - Livestream - The Vision and Strategy of Microsoft Business Systems

14oct10:00 am10:30 amThe Modern Manufacturer - Complex Cost Modeling

14oct12:00 pm12:30 pmGenerating Custom Inspection or Process Forms

19octAll Day22Stoneridge Connect Fall 2020

22oct11:00 am12:00 pmConfab with Stoneridge - Livestream - Stoneridge Connect Recap

28oct10:00 am10:30 amThe Modern Manufacturer - Engineering Change Orders

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X