Skip CIL execution

To skip CIL execution for processes, which use SysOperation framework (SysOperationServiceController)
- set break point to \Classes\SysOperationServiceController\runOperation and track how many parameters do you have to identify which serviceClass.callObject to modify
- identify the type of proxy variable
In my case proxy is of type FormletterService and I have only one parameter, method returns value
- notice value of methodName variable to identify which method to call on the object, in my case it is postSalesOrderPackingSlip
- declare new variable of real proxy type, in my case it is FormletterService
FormletterService   formletterService;

- afteryour serviceClass.callObject write additional code like this one (depending onparameters count, return value and method to call)

                    if (false)
                    {
                        formletterService = proxy;
                        operationReturnValue = formletterService.postSalesOrderPackingSlip(o1);
                    }

- set break point to serviceClass.callObject

- in debugger move execution cursor inside your if statement

 

If execution of process if marshaled under specific user usingSysOperationRPCFrameworkService::runServiceOperation

Two solutions for that

1. Set break poin to \Classes\SysOperationServiceController\run

In debugger move execution cursor to one of the this.runOperation(false/*sync*/);


2. Modify \Classes\SysOperationRPCFrameworkService\runServiceOperation tothe following look:


public static container runServiceOperation(ClassId controllerClassId, container packedController)
{
    // Use the runas API to transition to a CLR session
    new XppILExecutePermission().assert();
    /*
    TODO: temp solution to debug issue
    return SysDictClass::invokeStaticMethodIL(classStr(SysOperationServiceController),
                                        staticMethodStr(SysOperationServiceController, runServiceOperation),
                                        [controllerClassId, packedController]);
    */
    return SysOperationServiceController::runServiceOperation([controllerClassId, packedController]);
}

 

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units.
Join us.

Blog Tags