CLRObject.new Method [AX 2012]
Creates an instance of the CLRObject class.
Instances of the CLRObject class are used to wrap values that are returned from calls to common language runtime (CLR) methods.
If an attacker can control input to the new method, a security risk exists. Therefore, this method runs under Code Access Security. Calls to this method on the server require permission from the . Ensure that the user has development privileges by setting the security key to SysDevelopment on the control that calls the new method.
If a new ClrObject object fails to be instantiated, the Exception:Internal exception is thrown. To obtain the original CLR exception, call the CLRInterop::getLastException method.
This example creates a new System.Int32 CLR object.
void ClrObjectExample()
{
CLRObject clrObj;
InteropPermission perm;
anytype retVal;
perm = new InteropPermission(InteropKind::ClrInterop);
if (perm == null)
{
return;
}
perm.assert();
clrObj = new CLRObject("System.Int32");
CodeAccessPermission::revertAssert();
}