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

Error executing code: (object) has no valid runable code in method 'executePrintMyname'

(0) ShareShare
ReportReport
Posted on by

Hi All,

I do receive: Error executing code:  (object) has no valid runable code in method 'executePrintMyname'

when I run the following job

static public void executePrintMyname(Args _args)
{
PrintMyname PrintMyname;
PrintMyname = new PrintMyname();
PrintMyName.setMyName();
PrintMyName.printMyName();
pause;
}

for reference:

class PrintMyname
{
str 20 myName;
}

private void setMyName()
{
myName = "Isaac";
}

private void printMyName()
{
print myName;
}

Any Idea?

BR,

Michalis

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,908 Most Valuable Professional on at

    Compile the job, fix all compilation error and recompile the job before running it again.

    An obvious bug is that you're trying to call private methods outside the class where they're defined.

  • Community Member Profile Picture
    on at

    I have compiled without error. But still I face the same issue

  • Martin Dráb Profile Picture
    237,908 Most Valuable Professional on at

    I don't believe you've found a bug in compiler, because your code is obviously invalid and can't be compiled. How exactly do you compile the job and check the compilation result?

  • Community Member Profile Picture
    on at

    Compile Methods and then Class

  • Martin Dráb Profile Picture
    237,908 Most Valuable Professional on at

    All right, that's the problem. The compilation errors are in the job, executePrintMyname, not in the class. Remember, the job is what you're trying to run and what's the error message complaining about (no valid runable code in method 'executePrintMyname').

  • Community Member Profile Picture
    on at

    Hi Martin,

    I changed to Public and works.

    Thanks

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
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans