Тема: conpoke в CIL
Показать сообщение отдельно
Старый 22.03.2016, 16:22   #3  
kgksoft is offline
kgksoft
Участник
 
37 / 107 (4) +++++
Регистрация: 24.12.2003
Цитата:
Сообщение от S.Kuskov Посмотреть сообщение
Можете сделать законченный минимальный пример для воспроизведения этой ошибки. Т.е составить некоторый локальный пример данных, на котором данный пример кода можно запустить.
вчера обновился до
Recent kernel build 6.3.3000.2043
Ошибка осталась.

X++:
class test_conpoke
{
}

public static server void main(Args args)
{
    XppILExecutePermission xppILExecutePermission = new XppILExecutePermission();
    xppILExecutePermission.assert();
    runClassMethodIL(classStr(test_conpoke), staticMethodStr(test_conpoke, runIL), conNull());
    CodeAccessPermission::revertAssert();
}

private static server container runIL(container _pack)
{
container cElementUpdate = [0, '', '', 0.0, 0.0, 0.0]; //6 элементов
container cOperation = [[4,NoYes::Yes],[6,NoYes::Yes]];

container cElement = [563797946, 'A322880392', '0989666', 555.0, 0.0, 0.0];
int j = 1;

cElementUpdate = conpoke(
  cElementUpdate,
  conpeek(conpeek(cOperation, j), 1),
  conpeek(cElementUpdate, conpeek(conpeek(cOperation, j), 1))
    + conpeek(cElement, conpeek(conpeek(cOperation, j), 1))
  );

    return connull();
}
Поведение странное:
6, 10 раз запускаешь и получаешь ошибку, а потом вдруг ошибки нет, но
cElementUpdate == [0, '', '', 0.0, 0.0, 0.0, 555.0] //7 элементов

Ожидаю увидеть:
cElementUpdate == [0, '', '', 0.0, 555.0, 0.0] //6 элементов

Ошибка:
System.ArgumentOutOfRangeException: Требуется неотрицательное число.
Имя параметра: length
в System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
в System.Array.Copy(Array sourceArray, Array destinationArray, Int32 length)
в Microsoft.Dynamics.Ax.Xpp.PredefinedFunctions.qins(Object c, Int32 position, Object[] parameters)
в Microsoft.Dynamics.Ax.Xpp.PredefinedFunctions.qpoke(Object c, Int32 position, Object[] parameters)
в Dynamics.Ax.Application.test_conpoke.runIL(Object[] _pack) в test_conpoke.runIL.xpp:строка 10
в test_conpoke::runIL(Object[] )
в Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
в Dynamics.Ax.Application.SysDictClass.invokeStaticMethod(Object[] _params) в SysDictClass.invokeStaticMethod.xpp:строка 26
в SysDictClass::invokeStaticMethod(Object[] )
в Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
в Microsoft.Dynamics.Ax.Xpp.PredefinedFunctions.runAsInvoke(String className, String staticMethodName, Object[] parms, Object[]& exportInfolog)