案例:
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; }