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!
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 :)
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?
Hi Martin,
many thanks for reply,
bad news regarding Microsoft support (:
I will struggle further.
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156