IMethodReturnMessage::Exception Property
.NET Framework (current version)
Gets the exception thrown during the method call.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System::Exception^The exception object for the method call, or null if the method did not throw an exception.
| Exception | Condition |
|---|---|
| SecurityException | The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. |
The following example code shows a custom proxy that overrides RealProxy.Invoke in order to write the return message information, including whether the method threw an exception.
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; }
SecurityPermission
for operating with infrastructure code. Demand value: SecurityAction::LinkDemand; Permission value: SecurityPermissionFlag::Infrastructure
.NET Framework
Available since 1.1
Available since 1.1
Show: