Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

D365FO Update 4 - From extension class, referencing base enums that share a name with a non-public member causes compile error

$
0
0

In a fresh U4 instance I get a compiler error in an extension class when referencing enums that have the same name as non-public members in the extended class.

Can recreate this from scratch by creating an empty model in App Suite or as standalone package referencing app suite/foundation, and adding the following class (formletterParmData has private member called "documentStatus"):

[ExtensionOf(classStr(formletterParmData))]
public final class TGTestClass_Extension
{
    public void tgTestMethod()
    {
        if(DocumentStatus::Confirmation == DocumentStatus::Confirmation)
        {
            info('sky not falling');
        }
    }
}

Compiler error shows on each instance of "DocumentStatus":
"Field 'DocumentStatus' is protected and can only be referenced from within the inheritence hierarchy in which it is declared."

The compiler seems to think that these are attempted references to the class member, and not to an enum.

This happens with the base VM, and the base VM + latest binary hotfixes (up to 7.0.4425.35134/7.1.1541.30560).

What am I missing?  I suppose I could work around it by creating wrappers for the enums outside of the extension class, but that seems silly.  Hopefully someone can point out a simple mistake I must be making here?  Syntax for enums didn't change while I was asleep did it?  Something else in U4 I am not aware of?

Thanks!


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>