Throwing FaultException<T> with custom detail class with is terminating client connect
I'm throwing a FaultException with a custom fault detail class. The classes used in the fault detail are below as is the details of the exception that is received at the client. There are no exceptions on the server side at all... I'm handling all uncaught exceptions when they're thrown in the debugger and WCF doesn't seem to be encountering any... just killing the connection.
The problem seems to be the fact that one of my properties is a collection. If I take the DataMemberAttribute off the property that returns the collection I can throw the fault just fine.
Should I file a bug?
Cheers,
Drew
===== BEGIN CUSTOM FAULT DETAIL CLASSES ====
[DataContract(Name="orderPipelineErrorListFaultDetail", Namespace=http://schemas.mimeo.com/PublicAPI/Ordering/2006/08/01/FaultDetails.xsd)]publicsealedclassOrderPipelineErrorListFaultDetail
{
#region Type specific properties
privateOrderPipelineErrorDetailCollection pipelineErrorDetails =newOrderPipelineErrorDetailCollection();
[DataMember(Name="errors")]
publicOrderPipelineErrorDetailCollection PipelineErrorDetails
{
get
{
returnthis.pipelineErrorDetails;
}
}
#endregion
[CollectionDataContract(Name="errors",ItemName="error",Namespace=http://schemas.mimeo.com/PublicAPI/Ordering/2006/08/01/FaultDetails.xsd)]
publicsealedclassOrderPipelineErrorDetailCollection :List<OrderPipelineErrorDetail>
{
}
[DataContract(Name="error", Namespace=http://schemas.mimeo.com/PublicAPI/Ordering/2006/08/01/FaultDetails.xsd)]
publicsealedclassOrderPipelineErrorDetail
{
#region Constructors
public OrderPipelineErrorDetail()
{
}
public OrderPipelineErrorDetail(string typeName,string message)
{
this.typeName = typeName;
this.message = message;
}
#endregion
#region Type specific properties
privatestring typeName;
[DataMember(Name="typeName")]
publicstring TypeName
{
get
{
returnthis.typeName;
}
set
{
if(value ==null)
{
thrownewArgumentNullException();
}
this.typeName =value;
}
}
privatestring message;
[DataMember(Name="message")]
publicstring Message
{
get
{
returnthis.message;
}
set
{
if(value ==null)
{
thrownewArgumentNullException();
}
this.message =value;
}
}
#endregion
}
===== BEGIN EXCEPTION MESSAGE AND STACK TRACE ====
Test method Tests.OrderingServiceTest.GetQuoteWithMissingAddressPostalCode threw exception System.ServiceModel.CommunicationException, but exception System.ServiceModel.FaultException`1[[Mimeo.WebServices.PublicAPI.Ordering.OrderPipelineErrorListFaultDetail, Mimeo.OrderingWebServiceContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] was expected. Exception message: System.ServiceModel.CommunicationException: The underlying connection was closed: The connection was closed unexpectedly. > System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
End of inner exception stack trace
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Mimeo.WebServices.PublicAPI.Ordering.OrderingServiceContract.GetQuote(QuoteRequestMessage request)
at Tests.OrderingServiceTest.GetQuoteWithMissingAddressPostalCode() in D:\Drew's Documents\TFVC Root\Public Web Service APIs\Main\Ordering Web Service\Tests\Unit Tests\OrderingServiceTests.cs:line 317

