AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 31.10.2014, 16:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
SysDictCoder: Don’t forget the correct method signature when using runClassMethodIL()
Источник: http://feedproxy.google.com/~r/sysdi...3/_wJhWcUiTlw/
==============

If you think you know how something works, but really don’t and you’re not paying attention when errors pop up then you’re going to have a bad time.

So if you write this:

static private void myMethod() { info(funcName()); }
Or this:

static private void myMethod(container _container) { info(funcName()); }
Or this:

static private container myMethod() { info(funcName()); return conNull(); }
To use like this:

server static public void runIL() { container ret; XppILExecutePermission xppILExecutePermission; ; xppILExecutePermission = new XppILExecutePermission(); xppILExecutePermission.assert(); ret = runClassMethodIL(classStr(MyClass), staticMethodStr(MyClass, myMethod), conNull()); CodeAccessPermission::revertAssert(); }
Then you’ll get this error at runtime and be confused.

Error executing code: MyClass object does not have method 'myMethod'. The method is right there, how can it not exist? You try some variations but the error remains. Confusion intensifies. After few minutes of grumbling and hasty attempts to fix it common sense kicks in and you understand the correct way to write it is:

static private container myMethod(container _container = conNull()) { info(funcName()); return conNull(); }
Which makes perfect sense once you think about it because it’s the only way to get values in and out of the method. Of course, this could have been avoided by taking a step back and thinking a bit before typing.

Bonus tip for dealing with this runtime error:

Request for the permission of type 'XppILExecutePermission' failed. Check if your method calling runClassMethodIL() and creating the permission (runIL() in my example) is actually running on server. If not, runClassMethodIL() won’t find the XppILExecutePermission object because it’s on another tier.



Источник: http://feedproxy.google.com/~r/sysdi...3/_wJhWcUiTlw/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
littleax: Part2. Dynamics ax 2012. Split construct method by models. Blog bot DAX Blogs 0 28.05.2014 10:11
littleax: Part1. Dynamics ax 2012. Split construct method by models. Blog bot DAX Blogs 0 28.05.2014 10:11
ax-erp: Debug::assert() method calls in SYS layer triggering Dynamics AX 2012 debugger Blog bot DAX Blogs 0 10.12.2012 21:11
ax-erp: Overriding method for a control in dialog (RunBase framework) Blog bot DAX Blogs 0 18.09.2012 18:11
SysDictCoder: X++ method call performance Blog bot DAX Blogs 1 04.05.2009 22:13

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 20:28.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.