Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

X++ MenuFunction MorphX report run in CIL throw exception

Posted on by 10

Hi guys,

faced weird issue in AX 2012.

I have a customization on posting advance invoice.

Once invoice has been posted successfully following method is run from customization (some debug info lines are added for tracing purposes):

void printJournal()
{
    Args                args = new Args();
    ReportRun           reportRun;
    ;

    if (xSession::isCLRSession())
    {
        info('Running in a CLR session.');
    }
    else
    {
        info('Running in an interpreter session.');
        if (isRunningOnServer())
        {
            info('Running on the AOS.');
        }
        else
        {
            info('Running on the Client.');
        }
    }

    args.record(custInvoiceJourPrint);
    args.caller(this);
    new MenuFunction(menuitemOutputStr(FreeTextInvoiceOriginal), MenuItemType::Output).run(args);

}

This code is being called from class running on Server SalesInvoiceJournalPost (it is set in standard as runOn = Server).

When logic is run in p-code interpreter session code works well. Report is rendered on the screen and sale invoice itself posted correctly (report is not a SSRS report but old MorphX report).

But if "Execution in CIL" option is enabled, sales invoice is not posted and following line throw exception:

new MenuFunction(menuitemOutputStr(FreeTextInvoiceOriginal), MenuItemType::Output).run(args);

Exception is caught by block in FormLetterService class:

    catch
    {
        // exceptionTextFallThrough();
    
        code = WinAPIServer::getLastError();
        info(strFmt("error code - %1, ", code));
    }

It says that Error code is = 0;

Full CIL has been generated successfully, AOS restsrted and I deleted all old caches as well but no luck.

I tried to debug it in VS, all symbols have been loaded and code is the same as in p-code version but result is the same. No information about sort or CLR error.

I enabled all exceptions in VS and caught following:

Additional information:
Das Socket wurde abgebrochen, da ein asynchroner Empfangsvorgang vom Socket nicht innerhalb des zugewiesenen Zeitlimits von 00:02:00

In English: The socket was aborted because an asynchronous receive operation from the socket failed within the allotted timeout.

Any ideas would be much appreciated. Many thanks!

  • Jay Dev Profile Picture
    Jay Dev 10 on at
    RE: X++ MenuFunction MorphX report run in CIL throw exception

    Hi Martin,

    great idea to run report outside the CIL. I will try that way.

    Customer has some legacy code, it worked some how, I do not know the usage details.

    And I will suggest to upgrade in prospect it to SSRS version if we confirm budget.

    It is a good case to convince customer that time has come :)

  • Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: X++ MenuFunction MorphX report run in CIL throw exception

    Look at where exactly is the error thrown - it'll likely tell you more about the cause.

    If you insist on using a MorphX report, consider testing a simple report in CIL (not through posting). If it doesn't work either, it means that you must run the report outside CLR.

    By the way, how did you get into the situation that you're still using a MorphX report? AX 2012 was released elevent years ago. And if you upgraded from an older version of AX, you should have upgraded reports at that time. Isn't now time to finally solve this problem?

  • Jay Dev Profile Picture
    Jay Dev 10 on at
    RE: X++ MenuFunction MorphX report run in CIL throw exception

    Hi Martin,

    many thanks for reply,

    bad news regarding Microsoft support (:

    I will struggle further.

  • Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: X++ MenuFunction MorphX report run in CIL throw exception

    Trying to get the last WinAPI error is very strange when there is no WinAPi involved. That's the reason why it give you no information from it. Try ClrInterop::getLastException() instead.

    Pay attention to the stack trace, to know where the exception was thrown.

    Note that MorphX reports are deprecated and shouldn't be used anymore in AX 2012. Therefore running MorphX reports in CIL was likely never tested by Microsoft and you won't get any support from Microsoft for this scenario.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans