IMethodReturnMessage.Exception 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
메서드 호출 중에 throw된 예외를 가져옵니다.
public:
property Exception ^ Exception { Exception ^ get(); };
public Exception Exception { get; }
public Exception Exception { [System.Security.SecurityCritical] get; }
member this.Exception : Exception
[<get: System.Security.SecurityCritical>]
member this.Exception : Exception
Public ReadOnly Property Exception As Exception
속성 값
메서드 호출 null 또는 메서드가 예외를 throw하지 않은 경우의 예외 개체입니다.
- 특성
예외
직접 호출자는 인터페이스에 대한 참조를 통해 호출을 수행하며 인프라 권한이 없습니다.
예제
다음 예제 코드는 메서드가 예외를 throw했는지 여부를 포함하여 반환 메시지 정보를 작성하기 위해 RealProxy.Invoke를 재정의하는 사용자 지정 프록시를 보여 줍니다.
virtual IMessage^ Invoke( IMessage^ myMessage ) override
{
IMethodCallMessage^ myCallMessage = dynamic_cast<IMethodCallMessage^>(myMessage);
IMethodReturnMessage^ myIMethodReturnMessage =
RemotingServices::ExecuteMessage( myMarshalByRefObject, myCallMessage );
if ( myIMethodReturnMessage->Exception != nullptr )
{
Console::WriteLine( "{0} raised an exception.",
myIMethodReturnMessage->MethodName );
}
else
{
Console::WriteLine( "{0} does not raise an exception.",
myIMethodReturnMessage->MethodName );
}
return myIMethodReturnMessage;
}
public override IMessage Invoke(IMessage myMessage)
{
IMethodCallMessage myCallMessage = (IMethodCallMessage)myMessage;
IMethodReturnMessage myIMethodReturnMessage =
RemotingServices.ExecuteMessage(myMarshalByRefObject,myCallMessage);
if(myIMethodReturnMessage.Exception != null)
Console.WriteLine(myIMethodReturnMessage.MethodName +
" raised an exception.");
else
Console.WriteLine(myIMethodReturnMessage.MethodName +
" does not raised an exception.");
return myIMethodReturnMessage;
}
Public Overrides Function Invoke(myMessage As IMessage) As IMessage
Dim myCallMessage As IMethodCallMessage = CType(myMessage, IMethodCallMessage)
Dim myIMethodReturnMessage As IMethodReturnMessage = RemotingServices.ExecuteMessage _
(myMarshalByRefObject, myCallMessage)
If Not (myIMethodReturnMessage.Exception Is Nothing) Then
Console.WriteLine(myIMethodReturnMessage.MethodName + " raised an exception.")
Else
Console.WriteLine(myIMethodReturnMessage.MethodName + " does not raised an exception.")
End If
Return myIMethodReturnMessage
End Function 'Invoke