by sweisfeld via Shawn Weisfeld [MVP] on 11/13/2008 11:29:00 AM
I was attending the Dallas Connected Systems UG last night (http://biztalkusergroup.com/) and during the presentation I made the bold assertion that one should NOT use the "using statement" when working with WCF. Now I am a HUGE proponent of the using statement in normal circumstances. IMHO if it implements IDisposable use the using statement, except with WCF. This has to do with the way that WCF errors out and when that happens how the connection gets closed. . . Doing my best LeVar Burton "But you don't have to take my word for it" (http://en.wikipedia.org/wiki/Reading_Rainbow). Microsoft even says it in the documentation, "You should not use the using statement (Using in Visual Basic) because it may mask exceptions in certain failure modes. " (http://msdn.microsoft.com/en-us/library/ms735103.aspx)Also check out a post by Dan Rigsby that goes into more detail. http://www.danrigsby.com/blog/index.php/2008/02/26/dont-wrap-wcf-service-hosts-or-clients-in-a-using-statement/
Original Post: WCF & Using Statements
The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.