SysDictClass and some CAS
I ran into an issue when working with the SysDictClass. I am using this to do some 'smart' coding and make use of reflection, in order to speed up my development and not have to manually write code over and over again for the same type of thing. In doing so, I found out that this is considered a protected API now in DAX 4.0, and so you need to make use of an 'ExecutePermission' CAS Permission object, and assert that level of permission.
The error message looked similar to this:
"Request for the permission of type 'ExecutePermission' failed.
(S)\Classes\ExecutePermission\demand
(S)\Classes\DictClass\callObject
..."
So if you see this type of error, then make sure you perform an ExecutePermission Object. assert() before the code, and revert that assertion after the code block. In doing so, you will have gotten rid of this little issue.
This is the first time I had to make use of this code in a while, and so first time I ran into this being a protected API. I hope this helps someone out, as I did not find anything on the web, when searching.
Check back soon!
Find a job at: www.DynamicsAXJobs.com
The error message looked similar to this:
"Request for the permission of type 'ExecutePermission' failed.
(S)\Classes\ExecutePermission\demand
(S)\Classes\DictClass\callObject
..."
So if you see this type of error, then make sure you perform an ExecutePermission Object. assert() before the code, and revert that assertion after the code block. In doing so, you will have gotten rid of this little issue.
This is the first time I had to make use of this code in a while, and so first time I ran into this being a protected API. I hope this helps someone out, as I did not find anything on the web, when searching.
Check back soon!
Find a job at: www.DynamicsAXJobs.com
Labels: Code Example, DictClass, Dynamics AX 4.0, Error, Execute Permission, ExecutePermission, SysDictClass, X++
0 Comments:
Post a Comment
<< Home