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

july

16jul11:00 am12:00 pmConfab with Stoneridge - Livestream - Business Intelligence Power Hour

22jul10:00 am10:30 amOn the Job with Dynamics 365 - Manufacturing Material Handler

22jul12:00 pm1:00 pmImprove Field Service Delivery and Increase Customer Satisfaction

30jul11:00 am12:00 pmConfab with Stoneridge - Livestream - Power Apps Power Hour

august

03aug(aug 3)8:00 am07(aug 7)5:00 pmMicrosoft Dynamics GP Core Financials Bootcamp

05aug10:00 am10:30 amOn the Job with Dynamics 365 - Manufacturing Shipping / Receiving Department

05aug12:00 pm1:00 pmHow Ag Retailers Can Simplify Processing Equity Payments using Levridge

12aug10:00 am10:30 amWhy Levridge Grain? How to Achieve Efficient and Accurate Scale Tickets

12aug12:00 pm1:00 pmThe Three Paths to Dynamics 365 Finance and Supply Chain from Dynamics AX

13aug11:00 am12:00 pmConfab with Stoneridge - Livestream - Dynamics 365 2020 Wave 2 Preview

19aug10:00 am11:00 amWhat is Levridge? An Overview of the Ultimate Ag Solution

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