Personalized Community is here!
Quickly customize your community to find the content you seek.
Latest TechTalk Videos
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2022 Release Wave 1 PlanDynamics 365 release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.
2022 release wave 1 plan
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
Every now and then we have to introduce a fix to the X++ compiler, either for code or metadata validation. In many cases we introduce them as compile warnings (instead of errors) to avoid too much disruption, but sometimes we feel the mistake we're detecting is too important and a compile error is introduced. Since these fixes are typically done because we actually found an issue, it implies there is at least 1 customer that may find a compiler error in the future - correctly pointing out a problem in their code or metadata. Today I want to point out such an upcoming fix in the X++ compiler which will be brought in as an error, regarding the ternary operator ( expression ? trueexpression : falseexpression ) when used with enums.
Consider the following example:
MyEnum me = DifferentEnum::Value1;
In this case, the compiler will detect that you are trying to assign essentially the wrong type to your enum and will give you a compile error. Now, let's try the same mistake, but inside an expression using the ternary operator:
MyEnum me = (someExpression) ? DifferentEnum::Value1 : DifferentEnum::Value2;
In this case, the compiler is currently evaluating all the types here as integers (not enums), and it will not complain but rather compile without error. Clearly this is wrong. If enums are extensible, it may be even more problematic if this code is present, due to the nature of values of extensible enums.
This is expected to be included in a GA update somewhere after the April GA of PU33, and the above example will result in a compile error as of those versions, as it should. This of course means that any code that has this mistake in it, will no longer compile cleanly. Import to note that code already deployed (=compiled) will continue to run since this is a compiler-check only. Our runtime compatibility promise is something we cannot and will not break.
Business Applications communities