Procházet zdrojové kódy

2010-04-02 Atsushi Enomoto <[email protected]>

	* OperationInvokerHandler.cs : implement FaultContractInfos support.
	* ErrorProcessingHandler.cs : update comment. It is not relevant.


svn path=/trunk/mcs/; revision=154692
Atsushi Eno před 16 roky
rodič
revize
e50d376520

+ 5 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog

@@ -1,3 +1,8 @@
+2010-04-02  Atsushi Enomoto  <[email protected]>
+
+	* OperationInvokerHandler.cs : implement FaultContractInfos support.
+	* ErrorProcessingHandler.cs : update comment. It is not relevant.
+
 2010-04-02  Atsushi Enomoto  <[email protected]>
 
 	* EndpointDispatcher.cs : fill FaultContractInfos.

+ 1 - 1
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ErrorProcessingHandler.cs

@@ -27,7 +27,7 @@ namespace System.ServiceModel.Dispatcher
 					break;
 
 			// FIXME: remove them. FaultConverter also covers errors like EndpointNotFoundException, which this handler never covers. And checking converter twice is extraneous, so this part is just extraneous.
-			// FIXME: instead, FaultContractInfos should be checked
+			// FIXME: actually everything is done in OperationInvokerHandler now...
 			FaultConverter fc = FaultConverter.GetDefaultFaultConverter (dispatchRuntime.ChannelDispatcher.MessageVersion);
 			Message res = null;			
 			if (!fc.TryCreateFaultMessage (ex, out res))

+ 8 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/OperationInvokerHandler.cs

@@ -145,6 +145,14 @@ namespace System.ServiceModel.Dispatcher
 
 			var req = mrc.IncomingMessage;
 
+			var fe = ex as FaultException;
+			if (fe != null && fe.GetType ().IsGenericType) {
+				var t = fe.GetType ().GetGenericArguments () [0];
+				foreach (var fci in mrc.Operation.FaultContractInfos)
+					if (fci.Detail == t)
+						return Message.CreateMessage (req.Version, fe.CreateMessageFault (), fci.Action);
+			}
+
 			// FIXME: set correct name
 			FaultCode fc = new FaultCode (
 				"InternalServiceFault",