web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Abnormal termination of compiler when extending a class

(0) ShareShare
ReportReport
Posted on by 170

I am trying to create an extension on the PriceDisc class but I am receiving an error saying the compiler terminated abnormally. The environment is PU29. I saw an earlier post about someone needing to rebulid the solution before creating the extension. I tried doing that without any success. The following code is what I am currently working with. I extended the updateDiscountFromPriceDiscTable method to try to track down the source of the error. If only that method is present in the class, it will not terminate abnormally. It is when I include code for the buildFindPriceDiscountQuery method which is what I need to extend.

Can anyone see what I am doing wrong?

[ExtensionOf(classStr(PriceDisc))]
final class XXXPriceDisc_Extension
{
    protected internal void updateDiscountFromPriceDiscTable(PriceDiscTable _priceDiscTable)
    {
        next updateDiscountFromPriceDiscTable(_priceDiscTable);
    }

    protected internal Query buildFindPriceDiscountQuery(PriceType _relation,
        InventDimId _inventDimId,
        PriceDiscProductCodeType _itemCode,
        ItemId _itemRelation,
        PriceDiscPartyCodeType _accountCode,
        CustVendAC _accountRelation,
        UnitOfMeasureSymbol _unitId)
    {
        next buildFindPriceDiscountQuery(_relation, _inventDimId, _itemCode, _itemRelation, _accountCode, _accountRelation, _unitId);
    }

}

Severity Code Description Project File Line Suppression State
Error Abnormal termination with unhandled exception. Exception key: 7cef4cc8-5095-402d-9ce6-592e9f8d6b37. System.ArgumentNullException: Value cannot be null.
Parameter name: type1
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.TypeHandler.SameType(SemanticType type1, SemanticType type2)
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.TypeResolver.ValidateChainOfCommandMethod(ModelElement augmentedModelElement, Method method, MethodOrDelegate targetMethodOrDelegate)
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.TypeResolver.ValidateChainOfCommandMethodSignature(SymbolTable payload, Method method)
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.TypeResolver.VisitMethod(SymbolTable payload, Method method)
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.ClassTypeResolver.VisitMethod(SymbolTable payload, Method method)
at Microsoft.Dynamics.AX.Metadata.XppCompiler.AstVisitor`2.VisitMethodOrDelegate(TPayload payload, MethodOrDelegate methodOrDelegate)
at Microsoft.Dynamics.AX.Metadata.XppCompiler.AstVisitorWithDiagnostics`2.VisitMethodOrDelegate(TPayload payload, MethodOrDelegate methodOrDelegate)
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.TypeResolver.VisitMethodOrDelegate(SymbolTable payload, MethodOrDelegate methodOrDelegate)
at Microsoft.Dynamics.AX.Metadata.XppCompiler.AstVisitor`2.VisitMethods(TPayload payload, IEnumerable`1 methodOrDelegates)
at Microsoft.Dynamics.AX.Metadata.XppCompiler.AstVisitor`2.VisitMethods(TPayload payload, IDictionary`2 dictionary)
at Microsoft.Dynamics.AX.Metadata.XppCompiler.AstVisitor`2.VisitClass(TPayload payload, Class class_)
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.TypeResolver.VisitClass(SymbolTable payload, Class classInstance)
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.ClassTypeResolver.VisitClass(SymbolTable payload, Class classInstance)
at Microsoft.Dynamics.AX.Metadata.XppCompiler.AstVisitor`2.VisitClassOrInterface(TPayload payload, ClassOrInterface classOrInterface)
at Microsoft.Dynamics.AX.Metadata.XppCompiler.AstVisitorWithDiagnostics`2.VisitClassOrInterface(TPayload payload, ClassOrInterface classOrInterface)
at Microsoft.Dynamics.AX.Metadata.XppCompiler.AstVisitor`2.VisitModelElement(TPayload payload, ModelElement modelElement)
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.TypeResolver.VisitModelElement(SymbolTable payload, ModelElement modelElement)
at Microsoft.Dynamics.AX.Metadata.XppCompiler.AstVisitor`2.VisitCompilationUnit(TPayload payload, CompilationUnit compilationUnit)
at Microsoft.Dynamics.AX.Metadata.XppCompiler.AstVisitorWithDiagnostics`2.VisitCompilationUnit(TPayload payload, CompilationUnit compilationUnit)
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.TypeResolverPipelineEntry.Execute(CompilationUnit compilationUnit, TypeResolver resolver)
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.Pipeline.ExecutePipeline(CompilationUnit compilationUnit, IDiagnosticSink diagnostics, IXppcMetadataProvider metadataProvider, Stack`1 context)
at Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.MultipassAdministrator.RunPipeline(CompilationUnit compilationUnit, Pipeline pipeline)
at Microsoft.Dynamics.AX.Framework.Xlnt.ILGenerator.ClassTypeGenerator.<>c__DisplayClass6_0.<RunPipeline>b__0(String name)
at Microsoft.Dynamics.AX.Metadata.XppCompiler.ParallelCrashDumpUtil.<>c__DisplayClass1_0`1.<ForEach>b__2(T t)
at System.Threading.Tasks.Parallel.<>c__DisplayClass42_0`2.<PartitionerForEachWorker>b__1()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object ). XXX000941_TradeAgreementFields (VAR) [XXX] C:\AOSService\PackagesLocalDirectory\XXX\XXX\AxClass\XXXPriceDisc_Extension.xml 0
Error Compilation failed. 0
Error X++ compiler exited unexpectedly with failure code -1. 1

I have the same question (0)
  • Manikandan Boopathy M Profile Picture
    65 on at

    Hello Dauvis,

    Did you get solution for the above issue?

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    You can't use Chain of Command on classes/methods that are marked as internal. 

    https://community.dynamics.com/365/financeandoperations/b/mfp/posts/x-in-ax7-internal-keyword

  • Manikandan Boopathy M Profile Picture
    65 on at

    Hi Nikolaos,

    Thanks for your reply.

    The class and method I'm trying to use Chain of Command  is marked as Public Class and Protected Method.

    Class : CustAccountStatementIntDP

    Method : populateCustAccountStatementIntTmp

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    If you are referring to "above issue", then the expectation is that the details of your problem are the same than were shared in the above issue. If not the case, please share the details of your problem.

    You told us that you get this error when compiling your code. So, could it be that there's something in your code that would explain it? Please go through it, and if you need assistance, please share your code.

    Thanks!

  • @frankrasta Profile Picture
    30 on at

    HI, 

    You solved this issue?, 

    please send me solution.?

    i too extend class and then compile i has error. ¿need i, some reference??

    thnks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans