Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Weblog of a workaholic
Browse by Tags · View All
.NET General 53
C# 47
LINQ 16
Dependency injection 12
Validation Application Block 10
Enterprise Library 10
ASP.NET 9
LINQ to SQL 8
Entity Framework 8
CuttingEdge.Conditions 8

Archive · View All
August 2009 7
September 2009 6
March 2007 5
October 2006 3
May 2009 3
July 2008 3
November 2007 3
November 2006 2
January 2009 2
August 2008 2

Breaking changes in SmtpClient in .NET 4.0

May 6 2010 12:00AM by Steven   

In .NET 4.0 the SmtpClient class now implements IDisposable. This is a breaking change what you should watch out for.

For .NET 4.0 the BCL team decided to pool SMTP connections, just as .NET already did with database connections. This of course means that the SmtpClient class should implement IDisposable, just as the SqlConnection does. When STMP connections are pooled, the overhead over establishing a new connection is lowered, which is a good thing. However, this is a breaking change. Migrating your code to .NET 4.0, without any changes, could lead to the same connection pool timeout exceptions as we're are used with database connections.

Perhaps there are more of these 'hidden jams' inside the new .NET 4.0 framework. So when migrating to .NET 4.0, it's wise to recompile your project and run FxCop over it. When your code isn't too complicated, FxCop will spot the places where you didn't dispose any disposable object. And you can already prepare your code like this:

var client = new SmtpClient();

// Do not remove this using. In .NET 4.0
// SmtpClient implements IDisposable.
using (client as IDisposable)
{
client.Send(message);
}

Good luck.


Republished from .NET Junkie [7 clicks].  Read the original version here [1 clicks].

Steven
395 · 0% · 101
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]