09.02.2010, 00:08 | #1 |
Участник
|
Error: Multiple calls to CodeAccessPermission.Assert
Источник: http://alexvoy.blogspot.com/2010/02/...-calls-to.html
============== Multiple calls to CodeAccessPermission.Assert (S)\Classes\SkipAOSValidationPermission\assert (S)\Classes\BatchRun\runJob - line 166 (S)\Classes\BatchRun\do - line 54 (C)\Forms\BatchRun\Methods\doBatch - line 18 Sometimes I got this error while working with Change based alerts batch processing. After that the status of the related job in batch list changed to Executing, and the only way to get rid of it was deleting that job. This issue arises in [Classes]BatchRun.runJob method because of absence of closing revertAssert() method in case of exceptions after calling runas() method. So, my solution is to comment the existing call of revertAssert()... X++: if (batchClass.runsImpersonated()) { // Ok to assert here because the user name comes from // the batch table runAsPermission = new RunAsPermission(batch.CreatedBy); runAsPermission.assert(); // BP Deviation Documented runas(batch.CreatedBy, classnum(BatchRun), staticmethodstr(BatchRun, runJobStatic), [batchId]); // Alexey Voytsekhovskiy (SIS) (2010/02/08) (Demande #0074) // CodeAccessPermission::revertAssert(); } else { BatchRun::runJobStatic([batchId]); } X++: catch (Exception::UpdateConflictNotRecovered) { isErrorCaught = true; exception = Exception::UpdateConflictNotRecovered; } // Alexey Voytsekhovskiy (SIS) (2010/02/08) (Demande #0074) // in case of exception Permssion should be revert anyway!! CodeAccessPermission::revertAssert(); By the way, here is a short and sweet trick with multiple calls if needed. Источник: http://alexvoy.blogspot.com/2010/02/...-calls-to.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|