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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Calling into .NET from AX7 - Is Polymorphism supported?

(2) ShareShare
ReportReport
Posted on by

Hi, 

I have the following problem that I don't really understand. I have an event hook on the CustTable, which calls into a .NET class

[DataEventHandler(tableStr(CustTable), DataEventType::Updated)]
public static void CustTable_onUpdated(Common sender, DataEventArgs e)

{

   CustTable ct = sender as CustTable;
   var dispatcher = new Caller.Dispatcher();
   dispatcher.Call(ct);

}


My .NET class has the following method

public string Call(Dynamics.AX.Application.CustTable cTable)

{
...
}

However, the compiler complains

Severity Code Description Project File Line Suppression State
Error Method 'Call(System.Object)' is not found on type 'Caller.Dispatcher'. ......

However, if I used this signature;

public string Call(Microsoft.Dynamics.Ax.Xpp.Common cTable)
{
...
}

It doesn't complain. If I have both methods, it will still call the Base (Common) one, rather than the CustTable method. 

Can anyone shed some light on this?

Thanks, Jason

*This post is locked for comments

I have the same question (0)
  • Joris dG Profile Picture
    17,775 on at
    RE: Calling into .NET from AX7 - Is Polymorphism supported?

    I'm certain this basic scenario of passing CustTable to a C# method accepting CustTable worked at some point, but trying it now it seems like indeed that doesn't compile, I'm seeing the same issue. I'm following up with the compiler team here and will update you when I get an answer.

    On your question on polymorphism, I think I understand what you are asking but I think it's the same issue... if the compiler somehow considers common and CustTable as different types altogether, then that could lead to other issues. Speculation, let's fix the first issue first.

  • Community Member Profile Picture
    on at
    RE: Calling into .NET from AX7 - Is Polymorphism supported?

    Excellent, many thanks for the help!

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Willem van Duren Profile Picture

Willem van Duren 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans