.NET Framework 4.5 – Off to a great start

Brandon Bray

The .NET Framework just passed 3 million downloads. During this time, we’ve been monitoring your experience, paying attention to both telemetry and social traffic. One of the first things I do every morning is read through all the Twitter traffic about .NET. Many others on the .NET team do the same. If you’ve raised an issue about .NET compatibility, you’ve probably heard from Varun Gupta, program manager for compatibility in the .NET Framework. He wrote the following post to share what we’re doing with your feedback. –Brandon

In this post, we will look at the adoption we’ve seen and feedback we’ve received since the .NET Framework 4.5 was released, two months ago. Since then, we’ve been getting great feedback from customers around the world.  In particular, the garbage collector (GC) improvements in 4.5 have been producing incredible success stories.

Quick adoption of the .NET Framework 4.5

We are seeing great interest in the adoption of the new version of the .NET Framework both on the server and on the client. You can see one measurement of this adoption, in the chart below, which shows a growing number of .NET Framework 4.5 redistributable downloads per day. We’ve seen over 3 million downloads of the redistributable package, which doesn’t include distribution via Windows 8. We’re also seeing you request updates from services that don’t yet have support for the .NET Framework 4.5, particularly on social media. Keep that up.

Daily downloads of .NET Framework 4.5

Note: the regular dips in the chart above are the weekends.

Within Microsoft, we’ve already seen a swift adoption of the .NET Framework 4.5 in many products, including:

  • Microsoft Exchange Server 2013
  • Microsoft Sharepoint 2013
  • Microsoft Lync 2013
  • Microsoft System Center 2012
  • Microsoft.com

Please do tell us about other great stories in the comments. Feel free to post about websites, services, packaged software, or anything else that uses the .NET Framework 4.5.

Garbage collector <3

Several months ago, we saw how the garbage collector (GC) and runtime improvements we made in the .NET Framework 4.5 benefited the Bing team. Bing is a huge app, so we were curious to see if other, more typical server apps would see the same improvements with the .NET Framework 4.5. A couple of weeks ago, we received our answer from a developer who was pleased with the upgrade:

I installed the .NET framework 4.5 release onto the production servers and saw overall times drop and memory pressure dropped.  All with zero code changes.

That’s exactly the experience we were hoping to deliver. We’ve been spending a lot of time tuning the .NET Framework GC over the last few releases. It’s great to see that pay off in real results for your apps.

Listening to social media

We are seeing a great deal of enthusiasm about the .NET Framework 4.5 on Twitter. That’s one of the main places we look at to get a sense of what’s important to you. That’s also where we are seeing you request support from cloud providers who do not yet support the .NET Framework. Keep sharing up – we’re listening. The Windows Azure team just delivered support for the .NET Framework 4.5 in Windows Azure Web Sites. They are listening, too.

The following sites are the primary places where we engage:

All .NET Framework 4 apps run on the .NET Framework 4.5

We are hearing from and directly engaging with customers on a daily basis on adoption of the .NET Framework 4.5. In some cases, we are talking with developers like you, who build client software or websites that end-users rely on every day. In other cases, we are talking to large corporations that are starting, or have already completed, corporate roll-outs of the .NET Framework 4.5, typically on tens of thousands of machines. Those engagements and rollouts are all going very well.

For end-users, it is critically important that all .NET Framework 4 apps work the same on the .NET Framework 4 and 4.5. We are hearing about a small set of issues from developers. That pipeline of information is helping us deliver on the customer experience promise: to enable all .NET Framework 4 apps to work on the .NET Framework 4.5.

AppHarbor is one of the developer companies we’ve been working with.  We shipped the .NET Framework 4.5 on August 15, 2012, and AppHarbor was one of the first companies to announce .NET Framework 4.5 support in the cloud. On August 20th, they reported on their blog and on Twitter that they were having some difficulty with their roll-out. We looked at the issue and offered to help, since they are a hoster for many developers. Just 2 days later, they were able to offer a great experience running .NET 4.5 apps to their customers on the AppHarbor hosting platform. Great teamwork!

Last week, we released an important patch for the compatibility problems that you reported. In just a week, the patch has been installed on millions of machines, on Windows 8, Windows 7, and other operating systems. As a result, end-users will not encounter the problems that you experienced and reported. Those problems are now behind us, including the problem that we helped AppHarbor work around. There are a few smaller issues that we already know about — thanks to your reports — and we intend to fix those in another patch. We will continue to watch Microsoft Connect, social media, and forums for any other issues that you find. We appreciate your help.

Using Visual Studio 2012 to target the .NET Framework 4

We have heard from many of you that you want to use Visual Studio 2012 to target the .NET Framework 4. That’s great—it’s a supported scenario. However, we’ve seen some concerns about that experience, particularly in the comments on this blog. You want the app behavior you see on your development machine to perfectly match the customer experience. That’s exactly the behavior that we’ve designed into the product.

The .NET Framework 4.5 is like a service pack—it’s essentially the .NET Framework 4 SP1. It includes bug fixes that do not affect app compatibility and behavior, as you would expect from a service pack. At the same time, we took the opportunity to improve the product, so some .NET Framework 4.5 APIs provide more capability than their .NET Framework 4 counterparts. However, we made sure that .NET Framework 4 apps are not affected by this new behavior, so the experience is the same whether you’re using the app or debugging the app in Visual Studio 2012.

Let’s look at a few examples of these improvements. These changes are enabled only for apps that target the .NET Framework 4.5 and are ignored by .NET Framework 4 apps:

List<T>.ForEach. In the .NET Framework 4.5, the enumerator throws an InvalidOperationException exception if an element in the collection is modified, to safeguard data integrity and to help developers find race conditions. Here’s the source code for this method in the .NET Framework 4.5:

public void ForEach(Action<T> action) {
if( action == null) {
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
Contract.EndContractBlock();

int version = _version;

for(int i = 0 ; i < _size; i++) {
if (version != _version && BinaryCompatibility.TargetsAtLeast_Desktop_V4_5) {
break;
}
action(_items[i]);
}

if (version != _version && BinaryCompatibility.TargetsAtLeast_Desktop_V4_5)
ThrowHelper.ThrowInvalidOperationException(
ExceptionResource.InvalidOperation_EnumFailedVersion);
}

System.Uri. In the .NET Framework 4.5, an invalid mailto: URL throws an exception in the Uri class constructor, to comply with the URI RFC. This behavior is supported by the following source code from the UriParser class:

private enum UriQuirksVersion { 
// V1 = 1, // RFC 1738 - Not supported
V2 = 2, // RFC 2396
V3 = 3, // RFC 3986, 3987
}

private static readonly UriQuirksVersion s_QuirksVersion =
BinaryCompatibility.TargetsAtLeast_Desktop_V4_5
? UriQuirksVersion.V3 : UriQuirksVersion.V2;

internal static bool ShouldUseLegacyV2Quirks {
get {
return s_QuirksVersion <= UriQuirksVersion.V2;
}
}

In both cases, these changes are good improvements and don’t affect .NET Framework 4 app execution or development.  You’ll see the improved behavior only if you target your app to use the .NET Framework 4.5 or create a new app. We refer to these behaviors that differ between versions as quirks, and the .NET Framework decides which behavior to use based on the .NET Framework version your app targets. You can learn more about the internals of quirking by looking at the reference source code for System.Runtime.Versioning.BinaryCompatibility.

Of course, you can always test your app using the .NET Framework 4, either on a real machine or in a VM. Please do tell us if you find cases where we didn’t disable quirks for .NET Framework 4 apps running on the .NET Framework 4.5. We’ll consider fixing them or clarifying our documentation.

Wrapping up

We’ve really enjoyed watching the quick adoption of the .NET Framework 4.5 over the last few weeks. Many of you are heads down coding, building Windows Store apps, and upgrading your existing ASP.NET and WPF apps to use the new APIs. We also know that a lot of you are waiting for Windows Server 2012 guest OS releases in Windows Azure, to deploy .NET Framework 4.5 apps there.

The adoption by businesses, large and small, is also impressive. Microsoft IT has already deployed the .NET Framework 4.5 to tens of thousands of desktops. We have been talking with many other big corporations that have already completed their rollout. One expects that the developers in those companies are looking forward to taking advantage of the new version of Visual Studio and our new APIs.

Please tell us about any compatibility issues you run into, including issues arising from targeting the .NET Framework 4 in Visual Studio 2012. Your feedback helps us deliver on our compatibility promise.

Send reports of compatibility issues to netfx45compat@microsoft.com.

Follow us or talk to us on Twitterhttps://twitter.com/dotnet.

0 comments

Discussion is closed.

Feedback usabilla icon