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)

Error while executing sysoperation in batch process

(0) ShareShare
ReportReport
Posted on by 252

Hi,

I have created a sys operation framework functionality. The process works fine when the class is executed in UI through menu item. But when the same is executed as a batch job I am getting the below error in the execution log.

Error executing code: Wrong argument types for comparison.

But still the process is getting completed successfully. I have tried with full CIL generation and clearing the user data as well, but the error persist. Could anyone please provide a suggestion on this.

Thanks!

*This post is locked for comments

I have the same question (0)
  • Suren_G Profile Picture
    252 on at
    RE: Error while executing sysoperation in batch process

    Hi Martin,

    Just an information. Sometimes the exception comes from(Exception::Internal) and sometimes from CLRError. And as I mentioned before, the exception type is 'system.exception' and the exception value is 'null'. 

    A first chance exception of type 'System.Web.Services.Protocols.SoapException' occurred in System.Web.Services.dll

    Any suggestions!

    Thanks!

  • Suren_G Profile Picture
    252 on at
    RE: Error while executing sysoperation in batch process

    Hi Martin,

    Below is the exception type details

    - ex null System.Exception

    Below is the call stack while debugging

    > Dynamics.Ax.Application.dll89.netmodule!Dynamics.Ax.Application.TMSCommProxy.Sendrequest(string _xml) Line 20 X++

    Dynamics.Ax.Application.dll92.netmodule!Dynamics.Ax.Application.TMSProcessXML_Base.Execute() Line 14 X++

    Dynamics.Ax.Application.dll88.netmodule!Dynamics.Ax.Application.TMSAutoRouteAssignment.Initfromsalestable(Dynamics.Ax.Application.SalesTable _salesTable) Line 73 X++

    Dynamics.Ax.Application.dll88.netmodule!Dynamics.Ax.Application.TMSAutoRouteAssignment.Run() Line 9 X++

    Dynamics.Ax.Application.dll88.netmodule!Dynamics.Ax.Application.TMSAutoRouteAssignment.main(Dynamics.Ax.Application.Args _args) Line 9 X++

    Dynamics.Ax.Application.dll28.netmodule!Dynamics.Ax.Application.AGNSalesOrderBookingService.Processautorate(Dynamics.Ax.Application.AGNSalesOrderBookingContract dataContract) Line 41 X++

    Dynamics.Ax.Application.dll28.netmodule!Dynamics.Ax.Application.AGNSalesOrderBookingService.Execute(Dynamics.Ax.Application.AGNSalesOrderBookingContract dataContract) Line 34 X++

    [Lightweight Function]

    Microsoft.Dynamics.AX.Xpp.Support.dll!Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeInstanceCall(object instance, string MethodName, object[] parameters) Unknown

    Dynamics.Ax.Application.dll17.netmodule!Dynamics.Ax.Application.SysOperationServiceController.Runoperation(bool _async) Line 88 X++

    Dynamics.Ax.Application.dll17.netmodule!Dynamics.Ax.Application.SysOperationServiceController.runServiceOperation(object[] parameters) Line 22 X++

    [Lightweight Function]

    Microsoft.Dynamics.AX.Xpp.Support.dll!Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(System.Type type, string MethodName, object[] parameters) Unknown

    Dynamics.Ax.Application.dll156.netmodule!Dynamics.Ax.Application.SysDictClass.invokeStaticMethod(object[] _params) Line 26 X++

    [Lightweight Function]

    Microsoft.Dynamics.AX.Xpp.Support.dll!Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(System.Type type, string MethodName, object[] parameters) Unknown

    Microsoft.Dynamics.AX.Xpp.Support.dll!Microsoft.Dynamics.Ax.Xpp.PredefinedFunctions.runAsInvoke(string className, string staticMethodName, object[] parms, ref object[] exportInfolog) Unknown

    Ax32Serv.exe!Microsoft.Dynamics.Ax.MSIL.Interop.invokeRunAs(char* className, char* staticMethodName, _qlist_* params, _qlist_** retVal, _qlist_** exportInfolog) Unknown

    [AppDomain (Ax32Serv.exe, #1) -> AppDomain (X++ IL App Domain, #4)]

    Ax32Serv.exe!<Unknown function> Unknown

  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: Error while executing sysoperation in batch process

    Great, so please provide the information I asked for. When you get an exception, you should always look at what it is. There is nothing more important.

  • Suren_G Profile Picture
    252 on at
    RE: Error while executing sysoperation in batch process

    It stopped in Exception::CLRError block.

  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: Error while executing sysoperation in batch process

    What exactly did you seen when you debugged your code? Does it step into the catch (Exception::CLRError) block? If so, what's the type, message and call stack of the exception?

    By the way, the content of catch (Exception::Internal) block looks suspicious. It tries to work a CLR exception.

  • Suren_G Profile Picture
    252 on at
    RE: Error while executing sysoperation in batch process

    Hi Martin,

    Below is the implementation of sendRequest()

    str sendRequest(XML _xml)

    {

       str                 ret;

       System.Exception    ex;

       Microsoft.Dynamics.Ax.Tms.API.TmsService tmsService = new Microsoft.Dynamics.Ax.Tms.API.TmsService();

       perm.assert();

       try

       {

          ret = tmsService.ExecuteTransaction(_xml);

       }

       catch (Exception::CLRError)

       {

           // BP Deviation Documented

           ex = ClrInterop::getLastException();

           if (ex != null)

           {

               ex = ex.get_InnerException();

           }

       }

       catch (Exception::Internal)

       {

           // BP Deviation Documented

           ex = ClrInterop::getLastException();

           if (ex != null)

           {

               ex = ex.get_InnerException();

           }

       }

       if (ex != null)

       {

           TMSErrorLog::createLogEntry(ex);

           throw error(ex.get_Message());

       }

       CodeAccessPermission::revertAssert();

       return ret;

    }

    Below are the errors that I am getting in the Visual studio while debugging

    A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

    A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

    'Ax32Serv.exe' (CLR v4.0.30319: X++ IL App Domain): Loaded 'Microsoft.GeneratedCode'.

    A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

    A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

    'Ax32Serv.exe' (CLR v4.0.30319: X++ IL App Domain): Loaded 'Microsoft.GeneratedCode'.

    A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

    A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

    'Ax32Serv.exe' (CLR v4.0.30319: X++ IL App Domain): Loaded 'Microsoft.GeneratedCode'.

    A first chance exception of type 'System.Web.Services.Protocols.SoapException' occurred in System.Web.Services.dll

    A first chance exception of type 'System.Web.Services.Protocols.SoapException' occurred in System.Web.Services.dll

    A first chance exception of type 'System.Web.Services.Protocols.SoapException' occurred in System.Web.Services.dll

    A first chance exception of type 'System.Web.Services.Protocols.SoapException' occurred in System.Web.Services.dll

    A first chance exception of type 'System.Web.Services.Protocols.SoapException' occurred in System.Web.Services.dll

    'Ax32Serv.exe' (CLR v4.0.30319: X++ IL App Domain): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.SqlXml\v4.0_4.0.0.0__b77a5c561934e089\System.Data.SqlXml.dll'. Cannot find or open the PDB file.

    A first chance exception of type 'System.FormatException' occurred in mscorlib.dll

    A first chance exception of type 'System.FormatException' occurred in mscorlib.dll

  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: Error while executing sysoperation in batch process

    If I understand it correctly, you're saying that the problem isn't in the code you showed us. You have some failing code inside sendRequest(), where you're using wrong types when calling tmsService.ExecuteTransaction().

    The approach to solving the problem is the same - checking which types should be used and do it. If you're unable to solve it, show us the implementation of sendRequest() and share information collected while debugging.

  • Suren_G Profile Picture
    252 on at
    RE: Error while executing sysoperation in batch process

    Hi Martin,

    I have generated incremental CIL.

    ExecuteTransaction() is called inside TMSCommProxy.sendRequest(). The sendRequest() expects and returns 'str'. I tried by changing the 'XML xml' to 'str xml' in execute() so that the string value is retrieved and assigned to a string variable. But that is not causing any issue. The issue arises in ret = tmsService.ExecuteTransaction(_xml) only.

    Thanks!

  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: Error while executing sysoperation in batch process

    Didn't you forget to generate CIL?

    How is ExecuteTransaction() related to TMSCommProxy.sendRequest()?

    By the way, types used by the web service and the proxy class may be different, depending on how the proxy is generated. You want to verify types used by the method you're calling (TMSCommProxy.sendRequest() in this case), not types used by the web service.

  • Suren_G Profile Picture
    252 on at
    RE: Error while executing sysoperation in batch process

    Hi,

    On further debugging I found that the web service method accepts and returns 'String'. Below is the code where the error is trigerred.

    ret = tmsService.ExecuteTransaction(_xml);

    Below is the syntax

    String ExecuteTransaction(String _xml)

    The variable 'ret' was declared as "Xml     ret;" before and I have changed it to "str   ret" as the webservice method returns string. But still I am getting the same error.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans