Friday, December 13, 2013

What is the way to avoid memory leak and faulted state when using block to call WCF client ?

DO NOT USE using block:

try
{
    client.Close();
}
catch (CommunicationException e)
{
    client.Abort();
}
catch (TimeoutException e)
{
    client.Abort();
}
catch (Exception e)
{
    client.Abort();
    throw; //Make sure to keep original exception 
}

http://msdn.microsoft.com/en-us/library/aa355056.aspx

No comments:

Post a Comment