• AX 2012 解析CLR Object 抛出的错误


    案例:

    AifUtil::getClrErrorMessage()

    public static str getClrErrorMessage()
    {
        #File
        str exceptionMessage;
        System.Exception exObject, innerException;
        ;
    
        new InteropPermission(InteropKind::ClrInterop).assert();
    
        // BP deviation documented
        exObject = CLRInterop::getLastException();
        if(exObject)
        {
            // We will ignore the first message since it is always a fixed message of
            // "Exception has been thrown from target of invocation", this is from the reflection API being used
            // "ClrObject could not be created." - This is also of no use in most cases
            innerException = exObject.get_InnerException();
            while(innerException)
            {
                // BP deviation documented
                exceptionMessage = exceptionMessage + #delimiterSpace + CLRInterop::getAnyTypeForObject(innerException.get_Message());
                innerException = innerException.get_InnerException();
            }
        }
    
        CodeAccessPermission::revertAssert();
    
        return exceptionMessage;
    
    }
    

      

  • 相关阅读:
    String和StringBuilder和StringBuffer
    多态
    组件
    反向代理
    基础知识
    reflection
    v-model 与 v-bind:model
    tomcat端口占用问题
    socket
    简要概括内存机制
  • 原文地址:https://www.cnblogs.com/sxypeace/p/14103053.html
Copyright © 2020-2023  润新知