What is the equivalent of UnknownFaultException in WinFx Beta 2?

Hi,

one of the breaking changes in WinFx Beta 2 is the removal of the UnknownFaultException. I would like to know what is the equivalent class in Beta 2.

I have this snippet

if (exception.Contents.HasDetail)
{
//Do Something here
}

The FaultException does not have the Contents property. How can I have the same if clause in WinFx Beta 2


Thanks in advance





Answer this question

What is the equivalent of UnknownFaultException in WinFx Beta 2?

  • David Jemeyson

    Hi Adiavn

    As I said in my previous post, the problem with FaultException is that it does not have the Contents property.

    if (exception.Contents.HasDetail)
    {
    try
    {
    string errorCodeString = exception.Contents.GetReaderAtDetailContents().ReadElementString(errorCodeElementName,errorCodeElementNameNS);
    errorCode = Int32.Parse(errorCodeString );
    }
    catch
    {
    errorCode = 0;
    }
    }

    With the FaultException what is the equivalent Snippet

    Thank you

  • saMug

    I didn't use Contents property before,can you please let me know what kind of information this property will give (Some example to show what kind of fault information you are sending on service side,and How contents property captures that info will help us to know more about this problem)

    Typically we construct FaultException or Faultexception+Faultcontract to throw the exception,on client side,we can use same object to capture the fault info.

    http://windowssdk.msdn.microsoft.com/en-us/library/a9696563-d404-4905-942d-1e0834c26dea.aspx

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=285615&SiteID=1

    -Thank you

    Madhu



  • Roberto79

    It was remove between Jan and Feb CTP versions.

    Try using FaultException instead.


  • theumpteenthbrian

    I'm not sure, but try using:

    string errorCodeString = faultexception.CreateMessageFault().GetReaderAtDetailContents().ReadElementString(errorCodeElementName,errorCodeElementNameNS);


  • What is the equivalent of UnknownFaultException in WinFx Beta 2?